]> source.dussan.org Git - nextcloud-server.git/commitdiff
Dont do a cache rename if we cant delete the source file
authorRobin Appelman <icewind@owncloud.com>
Thu, 29 Jan 2015 14:52:40 +0000 (15:52 +0100)
committerRobin Appelman <icewind@owncloud.com>
Thu, 29 Jan 2015 14:52:40 +0000 (15:52 +0100)
apps/files_trashbin/lib/storage.php
lib/private/files/view.php

index 019fd490b525c0ce6d1dda8b4447be6265fb940e..175889ef95d621fa0a18aee4fdd79722202221f4 100644 (file)
@@ -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);
                        }
index 5ed7af9222c8257547bd5afeabefb945fd6fe901..6c720a6f5c05a520ee17de92bd78b53cee3117a8 100644 (file)
@@ -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(