diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-06-15 11:30:59 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-06-15 11:30:59 +0200 |
commit | b6165b68655fdf957d9b63ab982a5f8724fcc3de (patch) | |
tree | e378c43fc3df25dbaa9e40cf3f50e85a4c780840 /lib/private/connector | |
parent | 2806c9476c1d3daff5c97772cba1a43df4df7936 (diff) | |
parent | 4497aa4c68051ff75d1587dc1b01676926dfb466 (diff) | |
download | nextcloud-server-b6165b68655fdf957d9b63ab982a5f8724fcc3de.tar.gz nextcloud-server-b6165b68655fdf957d9b63ab982a5f8724fcc3de.zip |
Merge pull request #16912 from owncloud/webdav-smalltransferlockfix
Webdav PUT small file lock must be shared during hooks
Diffstat (limited to 'lib/private/connector')
-rw-r--r-- | lib/private/connector/sabre/file.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index 3e1b29a4f28..5aef30cc577 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -114,7 +114,7 @@ class File extends Node implements IFile { } try { - $this->fileView->lockFile($this->path, ILockingProvider::LOCK_EXCLUSIVE); + $this->fileView->lockFile($this->path, ILockingProvider::LOCK_SHARED); } catch (LockedException $e) { throw new FileLocked($e->getMessage(), $e->getCode(), $e); } @@ -192,6 +192,12 @@ class File extends Node implements IFile { )); } + try { + $this->fileView->changeLock($this->path, ILockingProvider::LOCK_EXCLUSIVE); + } catch (LockedException $e) { + throw new FileLocked($e->getMessage(), $e->getCode(), $e); + } + if ($needsPartFile) { // rename to correct path try { @@ -213,6 +219,12 @@ class File extends Node implements IFile { // since we skipped the view we need to scan and emit the hooks ourselves $partStorage->getScanner()->scanFile($internalPath); + try { + $this->fileView->changeLock($this->path, ILockingProvider::LOCK_SHARED); + } catch (LockedException $e) { + throw new FileLocked($e->getMessage(), $e->getCode(), $e); + } + if ($view) { $this->fileView->getUpdater()->propagate($hookPath); if (!$exists) { @@ -241,7 +253,7 @@ class File extends Node implements IFile { throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage()); } - $this->fileView->unlockFile($this->path, ILockingProvider::LOCK_EXCLUSIVE); + $this->fileView->unlockFile($this->path, ILockingProvider::LOCK_SHARED); return '"' . $this->info->getEtag() . '"'; } |