From d26c6cab90b15bcf9cbd0d95015d8ad2405f7914 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 9 Feb 2015 15:15:03 +0100 Subject: [PATCH] properly return false if we cant delete the source file --- apps/files_trashbin/tests/storage.php | 9 +++++---- lib/private/files/storage/common.php | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/files_trashbin/tests/storage.php b/apps/files_trashbin/tests/storage.php index d5bd7c318d3..d1468522dc2 100644 --- a/apps/files_trashbin/tests/storage.php +++ b/apps/files_trashbin/tests/storage.php @@ -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/'); diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index 164225de3e8..ca898bcc0b3 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -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; -- 2.39.5