]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix source path when share is a mount point
authorVincent Petry <pvince81@owncloud.com>
Thu, 8 Jan 2015 10:40:47 +0000 (11:40 +0100)
committerVincent Petry <pvince81@owncloud.com>
Thu, 8 Jan 2015 10:46:11 +0000 (11:46 +0100)
Whenever an external storage mount point is shared directly, its path is
empty which causes a leading slash to appear in the source path.

This fix removes the bogus leading slash in such situation.

apps/files_sharing/lib/share/file.php

index 93e4af3c393c2a8f47de20824514a4cf18da01b9..1d7eb77f7cf38fee9bcb0efa3dec8dd00e143835 100644 (file)
@@ -213,7 +213,9 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
                if ($itemType === 'folder') {
                        $source = \OCP\Share::getItemSharedWith('folder', $mountPoint, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE);
                        if ($source && $target !== '') {
-                               $source['path'] = $source['path'].'/'.$target;
+                               // note: in case of ext storage mount points the path might be empty
+                               // which would cause a leading slash to appear
+                               $source['path'] = ltrim($source['path'] . '/' . $target, '/');
                        }
                } else {
                        $source = \OCP\Share::getItemSharedWith('file', $mountPoint, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE);