]> source.dussan.org Git - nextcloud-server.git/commitdiff
properly return false if we cant delete the source file
authorRobin Appelman <icewind@owncloud.com>
Mon, 9 Feb 2015 14:15:03 +0000 (15:15 +0100)
committerRobin Appelman <icewind@owncloud.com>
Mon, 13 Apr 2015 13:13:03 +0000 (15:13 +0200)
apps/files_trashbin/tests/storage.php
lib/private/files/storage/common.php

index d5bd7c318d3d50e7ea2a106ae754b61ea2f049aa..d1468522dc211c4086f522a1bf9131a4eec46090 100644 (file)
@@ -202,12 +202,13 @@ class Storage extends \Test\TestCase {
 
                $cache = $storage->getCache();
 
-               Filesystem::mount($storage, [], '/' . $this->user . '/files');
+               Filesystem::mount($storage, [], '/' . $this->user);
+               $storage->mkdir('files');
                $this->userView->file_put_contents('test.txt', 'foo');
-               $this->assertTrue($storage->file_exists('test.txt'));
+               $this->assertTrue($storage->file_exists('files/test.txt'));
                $this->assertFalse($this->userView->unlink('test.txt'));
-               $this->assertTrue($storage->file_exists('test.txt'));
-               $this->assertTrue($cache->inCache('test.txt'));
+               $this->assertTrue($storage->file_exists('files/test.txt'));
+               $this->assertTrue($cache->inCache('files/test.txt'));
 
                // file should not be in the trashbin
                $results = $this->rootView->getDirectoryContent($this->user . '/files_trashbin/files/');
index 164225de3e88bc68f8fedb2a5332c49065f3721d..ca898bcc0b3f0b4bedbefc50aee07c8cb775823e 100644 (file)
@@ -566,9 +566,9 @@ abstract class Common implements Storage {
                $result = $this->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, true);
                if ($result) {
                        if ($sourceStorage->is_dir($sourceInternalPath)) {
-                               $sourceStorage->rmdir($sourceInternalPath);
+                               $result &= $sourceStorage->rmdir($sourceInternalPath);
                        } else {
-                               $sourceStorage->unlink($sourceInternalPath);
+                               $result &= $sourceStorage->unlink($sourceInternalPath);
                        }
                }
                return $result;