diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index bddb1f4a29422e53517ac7b72c05f43d0a9874cf..aa2aeee403b4de57a1b8dbdd6e640a8c2b08f110 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -689,9 +689,9 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
 		$result = $this->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, true);
 		if ($result) {
 			if ($sourceStorage->is_dir($sourceInternalPath)) {
-				$result &= $sourceStorage->rmdir($sourceInternalPath);
+				$result = $result && $sourceStorage->rmdir($sourceInternalPath);
 			} else {
-				$result &= $sourceStorage->unlink($sourceInternalPath);
+				$result = $result && $sourceStorage->unlink($sourceInternalPath);
 			}
 		}
 		return $result;
diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php
index 90decd20a991c718d723ea843d4678f64bf1fbe6..eed8bca957fa56ee6bef925119f2689ee9706822 100644
--- a/tests/lib/Files/ViewTest.php
+++ b/tests/lib/Files/ViewTest.php
@@ -17,6 +17,7 @@ use OC\Files\View;
 use OCP\Constants;
 use OCP\Files\Config\IMountProvider;
 use OCP\Files\FileInfo;
+use OCP\Files\GenericFileException;
 use OCP\Files\Storage\IStorage;
 use OCP\Lock\ILockingProvider;
 use OCP\Lock\LockedException;
@@ -1167,7 +1168,7 @@ class ViewTest extends \Test\TestCase {
 			->getMock();
 
 		$storage2->method('writeStream')
-			->willReturn(0);
+			->willThrowException(new GenericFileException("Failed to copy stream"));
 
 		$storage1->mkdir('sub');
 		$storage1->file_put_contents('foo.txt', '0123456789ABCDEFGH');