From ce0aa02aacee6b4e2641bdb1666f5650507ed28a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 29 Jan 2015 15:52:40 +0100 Subject: [PATCH] Dont do a cache rename if we cant delete the source file --- apps/files_trashbin/lib/storage.php | 4 +++- lib/private/files/view.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/files_trashbin/lib/storage.php b/apps/files_trashbin/lib/storage.php index 019fd490b52..175889ef95d 100644 --- a/apps/files_trashbin/lib/storage.php +++ b/apps/files_trashbin/lib/storage.php @@ -80,7 +80,9 @@ class Storage extends Wrapper { $result = \OCA\Files_Trashbin\Trashbin::move2trash($filesPath); // in cross-storage cases the file will be copied // but not deleted, so we delete it here - $this->storage->unlink($path); + if ($result) { + $this->storage->unlink($path); + } } else { $result = $this->storage->unlink($path); } diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 5ed7af9222c..6c720a6f5c0 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -527,7 +527,7 @@ class View { fclose($target); if ($result !== false) { - $storage1->unlink($internalPath1); + $result &= $storage1->unlink($internalPath1); } } } @@ -537,7 +537,7 @@ class View { if ($this->shouldEmitHooks()) { $this->emit_file_hooks_post($exists, $path2); } - } elseif ($result !== false) { + } elseif ($result) { $this->updater->rename($path1, $path2); if ($this->shouldEmitHooks($path1) and $this->shouldEmitHooks($path2)) { \OC_Hook::emit( -- 2.39.5