Skip to content

Commit

Permalink
fix: improve moving object store items to trashbin
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Sep 19, 2024
1 parent 00a27af commit 95427ec
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions apps/files_trashbin/lib/Trashbin.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,12 @@ 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
if (!($trashStorage->instanceOfStorage(ObjectStoreStorage::class) && $trashStorage->getId() === $sourceStorage->getId())) {
$trashStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);
$trashStorage->moveFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);

Check notice

Code scanning / Psalm

PossiblyUndefinedVariable Note

Possibly undefined variable $trashStorage, first seen on line 262
if ($sourceStorage->getCache()->inCache($sourceInternalPath)) {
$trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath);

Check notice

Code scanning / Psalm

PossiblyUndefinedVariable Note

Possibly undefined variable $trashStorage, first seen on line 262
}
} catch (\OCA\Files_Trashbin\Exceptions\CopyRecursiveException $e) {
$moveSuccessful = false;
Expand Down

0 comments on commit 95427ec

Please sign in to comment.