diff --git a/apps/files_versions/lib/Listener/FileEventsListener.php b/apps/files_versions/lib/Listener/FileEventsListener.php index 5fe41f76e492e..206c75ec6ec39 100644 --- a/apps/files_versions/lib/Listener/FileEventsListener.php +++ b/apps/files_versions/lib/Listener/FileEventsListener.php @@ -350,16 +350,24 @@ public function pre_renameOrCopy_hook(Node $source, Node $target): void { private function getPathForNode(Node $node): ?string { $user = $this->userSession->getUser()?->getUID(); if ($user) { - return $this->rootFolder + $path = $this->rootFolder ->getUserFolder($user) ->getRelativePath($node->getPath()); + + if ($path !== null) { + return $path; + } } $owner = $node->getOwner()?->getUid(); if ($owner) { - return $this->rootFolder + $path = $this->rootFolder ->getUserFolder($owner) ->getRelativePath($node->getPath()); + + if ($path !== null) { + return $path; + } } return null;