Don't unlink old renamed file if stream copy failed

This commit is contained in:
Michael Gapczynski 2013-04-13 15:04:46 -04:00
parent 4f6f6456aa
commit 9ead7c4776
1 changed files with 3 additions and 1 deletions

View File

@ -370,7 +370,9 @@ class View {
$target = $this->fopen($path2 . $postFix2, 'w'); $target = $this->fopen($path2 . $postFix2, 'w');
list($count, $result) = \OC_Helper::streamCopy($source, $target); list($count, $result) = \OC_Helper::streamCopy($source, $target);
list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1); list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
$storage1->unlink($internalPath1); if ($result !== false) {
$storage1->unlink($internalPath1);
}
} }
if ($this->fakeRoot == Filesystem::getRoot() && $result !== false) { if ($this->fakeRoot == Filesystem::getRoot() && $result !== false) {
\OC_Hook::emit( \OC_Hook::emit(