Skip to content

Commit

Permalink
fix: fix trashbin move with object store
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Sep 20, 2024
1 parent 2777947 commit 5861f4b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/files_trashbin/lib/Trashbin.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,15 +319,17 @@ public static function move2trash($file_path, $ownerOnly = false) {
return false;
}

$trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);

try {
$moveSuccessful = true;

// when moving within the same object store, the cache update done above is enough to move the file
// when moving within the same object store, the cache update done below is enough to move the file
if (!($trashStorage->instanceOfStorage(ObjectStoreStorage::class) && $trashStorage->getId() === $sourceStorage->getId())) {
$trashStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
}
if ($trashStorage->getCache()->inCache($sourceInternalPath)) {

Check notice

Code scanning / Psalm

PossiblyUndefinedVariable Note

Possibly undefined variable $trashStorage, first seen on line 296
$trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);

Check notice

Code scanning / Psalm

PossiblyUndefinedVariable Note

Possibly undefined variable $trashStorage, first seen on line 296
}
} catch (\OCA\Files_Trashbin\Exceptions\CopyRecursiveException $e) {
$moveSuccessful = false;
if ($trashStorage->file_exists($trashInternalPath)) {
Expand Down

0 comments on commit 5861f4b

Please sign in to comment.