Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable30] fix(trash): Fix deleting items from public share with write access #3627

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Changes from all commits
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
6 changes: 2 additions & 4 deletions lib/Trash/TrashBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,7 @@ public function moveToTrash(IStorage $storage, string $internalPath): bool {
$fileEntry = $storage->getCache()->get($internalPath);
$folderId = $storage->getFolderId();
$user = $this->userSession->getUser();
if (!$user) {
throw new \Exception("file moved to trash with no user in context");
}

// ensure the folder exists
$this->getTrashFolder($folderId);

Expand All @@ -255,7 +253,7 @@ public function moveToTrash(IStorage $storage, string $internalPath): bool {
$result = $trashStorage->moveFromStorage($storage, $internalPath, $targetInternalPath);
}
if ($result) {
$this->trashManager->addTrashItem($folderId, $name, $time, $internalPath, $fileEntry->getId(), $user->getUID());
$this->trashManager->addTrashItem($folderId, $name, $time, $internalPath, $fileEntry->getId(), $user?->getUID() ?? '');

// some storage backends (object/encryption) can either already move the cache item or cause the target to be scanned
// so we only conditionally do the cache move here
Expand Down
Loading