From cf245b80fe8bf0aed2b227e7f2cef5a15d3c5c8b Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Wed, 1 Jul 2015 12:52:06 +0200 Subject: [PATCH] Only delete part file on error if it is really a part file --- lib/private/connector/sabre/file.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index c28ac58499..e4f53a219d 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -146,7 +146,9 @@ class File extends Node implements IFile { } } catch (\Exception $e) { - $partStorage->unlink($internalPartPath); + if ($needsPartFile) { + $partStorage->unlink($internalPartPath); + } $this->convertToSabreException($e); } @@ -176,7 +178,9 @@ class File extends Node implements IFile { try { $this->fileView->changeLock($this->path, ILockingProvider::LOCK_EXCLUSIVE); } catch (LockedException $e) { - $partStorage->unlink($internalPartPath); + if ($needsPartFile) { + $partStorage->unlink($internalPartPath); + } throw new FileLocked($e->getMessage(), $e->getCode(), $e); }