diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-07-08 10:34:55 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-07-08 10:34:55 +0200 |
commit | d48d59661a18ad27d8364d6c6d83d00abe035a76 (patch) | |
tree | f953a7a411ee240539919bd02d0df837989d6b8a | |
parent | 312d82fe714c7878f2241c9ff567e14a0c5c817d (diff) | |
parent | 4aa2eff94c2fefa20fe4b26b6677074ee129ca50 (diff) | |
download | nextcloud-server-d48d59661a18ad27d8364d6c6d83d00abe035a76.tar.gz nextcloud-server-d48d59661a18ad27d8364d6c6d83d00abe035a76.zip |
Merge pull request #17289 from owncloud/stable8.1-files-cleanuppartfileonlyonce
Stable8.1 files cleanuppartfileonlyonce
-rw-r--r-- | lib/private/connector/sabre/file.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index 93244bea6ff..e4f53a219d2 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); } @@ -189,7 +193,6 @@ class File extends Node implements IFile { } if (!$run || $renameOkay === false || $fileExists === false) { \OC_Log::write('webdav', 'renaming part file to final file failed', \OC_Log::ERROR); - $partStorage->unlink($internalPartPath); throw new Exception('Could not rename part file to final file'); } } catch (\Exception $e) { @@ -350,6 +353,7 @@ class File extends Node implements IFile { if ($chunk_handler->isComplete()) { list($storage,) = $this->fileView->resolvePath($path); $needsPartFile = $this->needsPartFile($storage); + $partFile = null; try { $targetPath = $path . '/' . $info['name']; @@ -388,7 +392,7 @@ class File extends Node implements IFile { $info = $this->fileView->getFileInfo($targetPath); return $info->getEtag(); } catch (\Exception $e) { - if ($partFile) { + if ($partFile !== null) { $this->fileView->unlink($partFile); } $this->convertToSabreException($e); |