summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib/Storage.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/lib/Storage.php')
-rw-r--r--apps/files_trashbin/lib/Storage.php19
1 files changed, 12 insertions, 7 deletions
diff --git a/apps/files_trashbin/lib/Storage.php b/apps/files_trashbin/lib/Storage.php
index 04105dda6ce..d109be4ea75 100644
--- a/apps/files_trashbin/lib/Storage.php
+++ b/apps/files_trashbin/lib/Storage.php
@@ -125,10 +125,21 @@ class Storage extends Wrapper {
* @return bool
*/
protected function shouldMoveToTrash($path) {
+ $normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path);
+ $parts = explode('/', $normalized);
+ 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->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);
@@ -137,12 +148,6 @@ class Storage extends Wrapper {
}
}
- $normalized = Filesystem::normalizePath($this->mountPoint . '/' . $path);
- $parts = explode('/', $normalized);
- if (count($parts) < 4) {
- return false;
- }
-
if ($parts[2] === 'files' && $this->userManager->userExists($parts[1])) {
return true;
}