diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-05-27 15:19:46 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-06-01 13:22:57 +0200 |
commit | 8665a98744a8d3545859b809fc479ea216e45176 (patch) | |
tree | f6ba40325192c28ccf2b3e9bfc4fdc0b1281d31d /lib/private/connector/sabre/file.php | |
parent | 72776b165f3017057f7eb56534d346357d048db7 (diff) | |
download | nextcloud-server-8665a98744a8d3545859b809fc479ea216e45176.tar.gz nextcloud-server-8665a98744a8d3545859b809fc479ea216e45176.zip |
add locking for non-chunking webdav upload
Diffstat (limited to 'lib/private/connector/sabre/file.php')
-rw-r--r-- | lib/private/connector/sabre/file.php | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index 8e4460ef3b5..325206f060b 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -45,6 +45,7 @@ use OCP\Files\InvalidPathException; use OCP\Files\LockNotAcquiredException; use OCP\Files\NotPermittedException; use OCP\Files\StorageNotAvailableException; +use OCP\Lock\ILockingProvider; use Sabre\DAV\Exception; use Sabre\DAV\Exception\BadRequest; use Sabre\DAV\Exception\Forbidden; @@ -110,6 +111,8 @@ class File extends Node implements IFile { $partFilePath = $this->path; } + $this->fileView->lockFile($this->path, ILockingProvider::LOCK_EXCLUSIVE); + // the part file and target file might be on a different storage in case of a single file storage (e.g. single file share) /** @var \OC\Files\Storage\Storage $partStorage */ list($partStorage, $internalPartPath) = $this->fileView->resolvePath($partFilePath); @@ -232,6 +235,8 @@ class File extends Node implements IFile { throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage()); } + $this->fileView->unlockFile($this->path, ILockingProvider::LOCK_EXCLUSIVE); + return '"' . $this->info->getEtag() . '"'; } |