From 95427ecab489744fb6627dcbe8c7d84b70257950 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 19 Sep 2024 19:33:34 +0200 Subject: [PATCH] fix: improve moving object store items to trashbin Signed-off-by: Robin Appelman --- apps/files_trashbin/lib/Trashbin.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 29e4d5e8a3c10..e39620ec73dc3 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -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); + if ($sourceStorage->getCache()->inCache($sourceInternalPath)) { + $trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath); } } catch (\OCA\Files_Trashbin\Exceptions\CopyRecursiveException $e) { $moveSuccessful = false;