fixed re-share problems
This commit is contained in:
parent
3579ba1e41
commit
d3db4ee103
|
@ -200,13 +200,13 @@ class Hooks {
|
|||
$util = new Util($view, $userId);
|
||||
$path = $util->fileIdToPath($params['itemSource']);
|
||||
|
||||
//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']);
|
||||
//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['fileSource']);
|
||||
if ($sharedItem) {
|
||||
// if it is a re-share than the file is located in my Shared folder
|
||||
$path = '/Shared'.$sharedItem['file_target'];
|
||||
} else {
|
||||
$path = $util->fileIdToPath($params['itemSource']);
|
||||
$path = $util->fileIdToPath($params['fileSource']);
|
||||
}
|
||||
|
||||
$sharingEnabled = \OCP\Share::isEnabled();
|
||||
|
@ -224,7 +224,7 @@ class Hooks {
|
|||
$failed = array();
|
||||
|
||||
// Attempt to set shareKey
|
||||
if (!$util->setSharedFileKeyfiles($session, $usersSharing, $path)) {
|
||||
if (!$util->setSharedFileKeyfiles($session, $usersSharing, $path)) {
|
||||
|
||||
$failed[] = $path;
|
||||
}
|
||||
|
|
|
@ -983,14 +983,21 @@ class Util {
|
|||
*/
|
||||
public function getAllFiles($dir) {
|
||||
$result = array();
|
||||
|
||||
$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) {
|
||||
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 {
|
||||
$result[] = substr($c['path'], 5);
|
||||
$result[] = $shared.substr($c['path'], 5);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
|
|
Loading…
Reference in New Issue