summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-10-19 19:56:42 +0200
committerGitHub <noreply@github.com>2018-10-19 19:56:42 +0200
commit543c8634340607c5dd088b9cbdcd85700222ee0b (patch)
treec1f5e8bf184fe77182dcc95a65997064edbf3113 /apps/dav/lib
parent0b27487f83e1f0697c0375aeffee5802a1b717fb (diff)
parentb51e503aea0deb28916cd6e2adcddd187651eee5 (diff)
downloadnextcloud-server-543c8634340607c5dd088b9cbdcd85700222ee0b.tar.gz
nextcloud-server-543c8634340607c5dd088b9cbdcd85700222ee0b.zip
Merge pull request #11931 from nextcloud/bug/do_not_emit_pre_hooks_twice_objectstore
Do not emit preHooks twice on non-part-storage
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/Connector/Sabre/File.php11
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);
}