diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2019-08-07 16:47:43 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-08-07 16:47:43 +0200 |
commit | 8e7c287e2ac4bd60d69a77fb7295e8ea2b8b9617 (patch) | |
tree | 57aa7da893c94035839d9a4780161c98166e5d41 /apps/files_trashbin | |
parent | b1832c8bef99be60acf7923fad2c58a726bfeecb (diff) | |
download | nextcloud-server-8e7c287e2ac4bd60d69a77fb7295e8ea2b8b9617.tar.gz nextcloud-server-8e7c287e2ac4bd60d69a77fb7295e8ea2b8b9617.zip |
Use the owner from the storage
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r-- | apps/files_trashbin/lib/Storage.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/files_trashbin/lib/Storage.php b/apps/files_trashbin/lib/Storage.php index ef341ada948..d109be4ea75 100644 --- a/apps/files_trashbin/lib/Storage.php +++ b/apps/files_trashbin/lib/Storage.php @@ -127,13 +127,19 @@ class Storage extends Wrapper { protected function shouldMoveToTrash($path) { $normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path); $parts = explode('/', $normalized); - if (count($parts) < 4 || !$this->userManager->userExists($parts[1])) { + if (count($parts) < 4) { return false; } // check if there is a app which want to disable the trash bin for this file $fileId = $this->storage->getCache()->getId($path); - $nodes = $this->rootFolder->getUserFolder($parts[1])->getById($fileId); + $owner = $this->storage->getOwner($path); + if ($owner === false) { + $nodes = $this->rootFolder->getById($fileId); + } else { + $nodes = $this->rootFolder->getUserFolder($owner)->getById($fileId); + } + foreach ($nodes as $node) { $event = $this->createMoveToTrashEvent($node); $this->eventDispatcher->dispatch('OCA\Files_Trashbin::moveToTrash', $event); @@ -142,7 +148,7 @@ class Storage extends Wrapper { } } - if ($parts[2] === 'files') { + if ($parts[2] === 'files' && $this->userManager->userExists($parts[1])) { return true; } |