Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use the owner from the storage
Signed-off-by: Roeland Jago Douma <[email protected]>
  • Loading branch information
rullzer committed Aug 7, 2019
commit 8e7c287e2ac4bd60d69a77fb7295e8ea2b8b9617
12 changes: 9 additions & 3 deletions apps/files_trashbin/lib/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,19 @@ public function rmdir($path) {
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);
Expand All @@ -142,7 +148,7 @@ protected function shouldMoveToTrash($path) {
}
}

if ($parts[2] === 'files') {
if ($parts[2] === 'files' && $this->userManager->userExists($parts[1])) {
return true;
}

Expand Down