diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 442abc13670c6..442b0b591c124 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -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)) { + $trashStorage->getUpdater()->renameFromStorage($sourceStorage, $sourceInternalPath, $trashInternalPath); + } } catch (\OCA\Files_Trashbin\Exceptions\CopyRecursiveException $e) { $moveSuccessful = false; if ($trashStorage->file_exists($trashInternalPath)) {