diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-06-23 13:52:27 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-10-20 14:14:56 +0200 |
commit | 23eaf27a5b630cbbf0b9a664ef1945a3a5b30c31 (patch) | |
tree | ddcc3c34b97254916e60f82c6163b5214d268e16 /apps | |
parent | 1a84c8e9d28ff153996dcb6e97fe4115ca038028 (diff) | |
download | nextcloud-server-23eaf27a5b630cbbf0b9a664ef1945a3a5b30c31.tar.gz nextcloud-server-23eaf27a5b630cbbf0b9a664ef1945a3a5b30c31.zip |
locking for chunked dav upload
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/connector/sabre/file.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/dav/lib/connector/sabre/file.php b/apps/dav/lib/connector/sabre/file.php index 9e515cdc687..a0581de53ae 100644 --- a/apps/dav/lib/connector/sabre/file.php +++ b/apps/dav/lib/connector/sabre/file.php @@ -379,12 +379,13 @@ class File extends Node implements IFile { $this->emitPreHooks($exists, $targetPath); $this->changeLock(ILockingProvider::LOCK_EXCLUSIVE); + /** @var \OC\Files\Storage\Storage $targetStorage */ + list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath); if ($needsPartFile) { // we first assembly the target file as a part file $partFile = $path . '/' . $info['name'] . '.ocTransferId' . $info['transferid'] . '.part'; - - + /** @var \OC\Files\Storage\Storage $targetStorage */ list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile); @@ -392,8 +393,7 @@ class File extends Node implements IFile { // here is the final atomic rename $renameOkay = $targetStorage->moveFromStorage($partStorage, $partInternalPath, $targetInternalPath); - - $fileExists = $this->fileView->file_exists($targetPath); + $fileExists = $targetStorage->file_exists($targetInternalPath); if ($renameOkay === false || $fileExists === false) { \OCP\Util::writeLog('webdav', '\OC\Files\Filesystem::rename() failed', \OCP\Util::ERROR); // only delete if an error occurred and the target file was already created @@ -427,6 +427,9 @@ class File extends Node implements IFile { $this->emitPostHooks($exists, $targetPath); $info = $this->fileView->getFileInfo($targetPath); + + $this->fileView->unlockFile($targetPath, ILockingProvider::LOCK_SHARED); + return $info->getEtag(); } catch (\Exception $e) { if ($partFile !== null) { |