Skip to content
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 @@ -239,9 +239,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 @@ -263,7 +261,7 @@ public function moveToTrash(IStorage $storage, string $internalPath): bool {
$originalLocation = $storage->getWrapperStorage()->getUnjailedPath($originalLocation);
}

$this->trashManager->addTrashItem($folderId, $name, $time, $originalLocation, $fileEntry->getId(), $user->getUID());
$this->trashManager->addTrashItem($folderId, $name, $time, $originalLocation, $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