From: Roeland Jago Douma Date: Wed, 7 Aug 2019 14:47:43 +0000 (+0200) Subject: Use the owner from the storage X-Git-Tag: v16.0.5RC1~10^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1db1d2ce9d98edc0303eb69e7aa8187be516a0d0;p=nextcloud-server.git Use the owner from the storage Signed-off-by: Roeland Jago Douma --- diff --git a/apps/files_trashbin/lib/Storage.php b/apps/files_trashbin/lib/Storage.php index 9c714d30aef..502add52839 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; }