aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-02-28 12:16:37 +0100
committerCôme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com>2023-05-04 17:55:09 +0000
commit6034cc6893eba6e294970966ad9a6389488948d1 (patch)
treef752e995291380d240ef24fa3298bdd4556003a6 /apps/dav
parentf8b4e0025b46a115d62ab088174c654bde28ed22 (diff)
downloadnextcloud-server-6034cc6893eba6e294970966ad9a6389488948d1.tar.gz
nextcloud-server-6034cc6893eba6e294970966ad9a6389488948d1.zip
Make sure to never trigger files hooks on a null path
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/Connector/Sabre/File.php18
1 files changed, 10 insertions, 8 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