Only delete part file on error if it is really a part file

This commit is contained in:
Vincent Petry 2015-07-01 12:52:06 +02:00
parent fd4efdded9
commit cf245b80fe

View file

@ -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);
}