diff options
Diffstat (limited to 'apps/files_sharing/lib/share/file.php')
-rw-r--r-- | apps/files_sharing/lib/share/file.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php index 91595461a61..2ae7fdc16ab 100644 --- a/apps/files_sharing/lib/share/file.php +++ b/apps/files_sharing/lib/share/file.php @@ -61,7 +61,8 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { * @return string */ public function generateTarget($filePath, $shareWith, $exclude = null) { - $target = '/'.basename($filePath); + $shareFolder = \OCA\Files_Sharing\Helper::getShareFolder(); + $target = \OC\Files\Filesystem::normalizePath($shareFolder . '/' . basename($filePath)); // for group shares we return the target right away if ($shareWith === false) { @@ -70,6 +71,18 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { \OC\Files\Filesystem::initMountPoints($shareWith); $view = new \OC\Files\View('/' . $shareWith . '/files'); + + if (!$view->is_dir($shareFolder)) { + $dir = ''; + $subdirs = explode('/', $shareFolder); + foreach ($subdirs as $subdir) { + $dir = $dir . '/' . $subdir; + if (!$view->is_dir($dir)) { + $view->mkdir($dir); + } + } + } + $excludeList = \OCP\Share::getItemsSharedWithUser('file', $shareWith, self::FORMAT_TARGET_NAMES); if (is_array($exclude)) { $excludeList = array_merge($excludeList, $exclude); |