diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-10-23 18:16:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-23 18:16:59 +0200 |
commit | e88c8d15babe870bc52b1d24506d0bf41aa71d07 (patch) | |
tree | ba6ac57daad40dd7ae5d62d98595e1df258d45ad /apps | |
parent | 7894c40f54576a993c7650d4f8210f3bc6e120c5 (diff) | |
parent | e81f42333bf39935c46aba1337a7ec503f343d32 (diff) | |
download | nextcloud-server-e88c8d15babe870bc52b1d24506d0bf41aa71d07.tar.gz nextcloud-server-e88c8d15babe870bc52b1d24506d0bf41aa71d07.zip |
Merge pull request #11961 from nextcloud/backport/11931/stable14
[14] Do not emit preHooks twice on non-part-storage
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/File.php | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index e46bdcb2984..9e927ff85e5 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -140,6 +140,8 @@ class File extends Node implements IFile { list($partStorage) = $this->fileView->resolvePath($this->path); $needsPartFile = $partStorage->needsPartFile() && (strlen($this->path) > 1); + $view = \OC\Files\Filesystem::getView(); + if ($needsPartFile) { // mark file as partial while uploading (ignored by the scanner) $partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part'; @@ -147,11 +149,11 @@ class File extends Node implements IFile { // upload file directly as the final path $partFilePath = $this->path; - $this->emitPreHooks($exists); + if ($view && !$this->emitPreHooks($exists)) { + throw new Exception('Could not write to final file, canceled by hook'); + } } - $view = \OC\Files\Filesystem::getView(); - // 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); @@ -159,9 +161,6 @@ class File extends Node implements IFile { list($storage, $internalPath) = $this->fileView->resolvePath($this->path); try { if (!$needsPartFile) { - if ($view && !$this->emitPreHooks($exists)) { - throw new Exception('Could not write to final file, canceled by hook'); - } $this->changeLock(ILockingProvider::LOCK_EXCLUSIVE); } |