diff options
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/File.php | 18 | ||||
-rw-r--r-- | apps/dav/lib/Upload/ChunkingV2Plugin.php | 16 |
2 files changed, 17 insertions, 17 deletions
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index b0f17417d21..a7cafeb4a5e 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -422,14 +422,15 @@ class File extends Node implements IFile { } } - /** - * @param string $path - */ - private function emitPreHooks($exists, $path = null) { + private function emitPreHooks(bool $exists, ?string $path = null): bool { if (is_null($path)) { $path = $this->path; } $hookPath = Filesystem::getView()->getRelativePath($this->fileView->getAbsolutePath($path)); + if ($hookPath === null) { + // We only trigger hooks from inside default view + return true; + } $run = true; if (!$exists) { @@ -450,14 +451,15 @@ class File extends Node implements IFile { return $run; } - /** - * @param string $path - */ - private function emitPostHooks($exists, $path = null) { + private function emitPostHooks(bool $exists, ?string $path = null): void { if (is_null($path)) { $path = $this->path; } $hookPath = Filesystem::getView()->getRelativePath($this->fileView->getAbsolutePath($path)); + if ($hookPath === null) { + // We only trigger hooks from inside default view + return; + } if (!$exists) { \OC_Hook::emit(\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_post_create, [ \OC\Files\Filesystem::signal_param_path => $hookPath diff --git a/apps/dav/lib/Upload/ChunkingV2Plugin.php b/apps/dav/lib/Upload/ChunkingV2Plugin.php index cb7c802125c..6b660fb7c6f 100644 --- a/apps/dav/lib/Upload/ChunkingV2Plugin.php +++ b/apps/dav/lib/Upload/ChunkingV2Plugin.php @@ -255,17 +255,15 @@ class ChunkingV2Plugin extends ServerPlugin { public function beforeDelete(RequestInterface $request, ResponseInterface $response) { try { - $this->prepareUpload($request->getPath()); - if (!$this->uploadFolder instanceof UploadFolder) { - return true; - } - - [$storage, $storagePath] = $this->getUploadStorage($this->uploadPath); - $storage->cancelChunkedWrite($storagePath, $this->uploadId); - return true; - } catch (NotFound $e) { + $this->prepareUpload(dirname($request->getPath())); + $this->checkPrerequisites(); + } catch (StorageInvalidException|BadRequest|NotFound $e) { return true; } + + [$storage, $storagePath] = $this->getUploadStorage($this->uploadPath); + $storage->cancelChunkedWrite($storagePath, $this->uploadId); + return true; } /** |