add locking for non-chunking webdav upload

This commit is contained in:
Robin Appelman 2015-05-27 15:19:46 +02:00
parent 72776b165f
commit 8665a98744

View file

@ -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() . '"';
}