diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-08-12 16:44:50 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-14 20:35:33 +0200 |
commit | 688981b55c1c27fbd18fd0a3facb08f491fcf9bb (patch) | |
tree | fee3844b0035bbd56c65c3b3e293560a6aee3461 /lib/private/connector | |
parent | 9202d2f45a2de77709378aff15c7397f0ae099ce (diff) | |
download | nextcloud-server-688981b55c1c27fbd18fd0a3facb08f491fcf9bb.tar.gz nextcloud-server-688981b55c1c27fbd18fd0a3facb08f491fcf9bb.zip |
allow hook cancel
Diffstat (limited to 'lib/private/connector')
-rw-r--r-- | lib/private/connector/sabre/file.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index c9f81b98aa5..17659c96b07 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -150,7 +150,9 @@ class File extends Node implements IFile { try { $view = \OC\Files\Filesystem::getView(); if ($view) { - $this->emitPreHooks($exists); + $run = $this->emitPreHooks($exists); + } else { + $run = true; } try { @@ -165,9 +167,11 @@ class File extends Node implements IFile { if ($needsPartFile) { // rename to correct path try { - $renameOkay = $storage->moveFromStorage($partStorage, $internalPartPath, $internalPath); - $fileExists = $storage->file_exists($internalPath); - if ($renameOkay === false || $fileExists === false) { + if ($run) { + $renameOkay = $storage->moveFromStorage($partStorage, $internalPartPath, $internalPath); + $fileExists = $storage->file_exists($internalPath); + } + if (!$run || $renameOkay === false || $fileExists === false) { \OCP\Util::writeLog('webdav', 'renaming part file to final file failed', \OCP\Util::ERROR); throw new Exception('Could not rename part file to final file'); } @@ -227,6 +231,7 @@ class File extends Node implements IFile { \OC\Files\Filesystem::signal_param_path => $hookPath, \OC\Files\Filesystem::signal_param_run => &$run, )); + return $run; } private function emitPostHooks($exists, $path = null) { |