Skip to content
Snippets Groups Projects
Commit d3db4ee1 authored by Florin Peter's avatar Florin Peter
Browse files

fixed re-share problems

parent 3579ba1e
Branches
No related tags found
No related merge requests found
...@@ -201,12 +201,12 @@ class Hooks { ...@@ -201,12 +201,12 @@ class Hooks {
$path = $util->fileIdToPath($params['itemSource']); $path = $util->fileIdToPath($params['itemSource']);
//check if this is a reshare action, that's true if the item source is already shared with me //check if this is a reshare action, that's true if the item source is already shared with me
$sharedItem = \OCP\Share::getItemSharedWithBySource($params['itemType'], $params['itemSource']); $sharedItem = \OCP\Share::getItemSharedWithBySource($params['itemType'], $params['fileSource']);
if ($sharedItem) { if ($sharedItem) {
// if it is a re-share than the file is located in my Shared folder // if it is a re-share than the file is located in my Shared folder
$path = '/Shared'.$sharedItem['file_target']; $path = '/Shared'.$sharedItem['file_target'];
} else { } else {
$path = $util->fileIdToPath($params['itemSource']); $path = $util->fileIdToPath($params['fileSource']);
} }
$sharingEnabled = \OCP\Share::isEnabled(); $sharingEnabled = \OCP\Share::isEnabled();
......
...@@ -986,11 +986,18 @@ class Util { ...@@ -986,11 +986,18 @@ class Util {
$content = $this->view->getDirectoryContent($this->userFilesDir.$dir); $content = $this->view->getDirectoryContent($this->userFilesDir.$dir);
// handling for re shared folders
$path_split = explode( '/', $dir );
$shared = '';
if($path_split[1] === 'Shared') {
$shared = '/Shared';
}
foreach ($content as $c) { foreach ($content as $c) {
if ($c['type'] === "dir" ) { if ($c['type'] === "dir" ) {
$result = array_merge($result, $this->getAllFiles(substr($c['path'],5))); $result = array_merge($result, $this->getAllFiles($shared.substr($c['path'],5)));
} else { } else {
$result[] = substr($c['path'], 5); $result[] = $shared.substr($c['path'], 5);
} }
} }
return $result; return $result;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment