aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions/lib
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2024-01-17 17:07:59 +0100
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2024-01-18 10:21:46 +0000
commiteaddf3601252b9eeee3e25df6d26e6f3a867d897 (patch)
tree38f4fa57f59ceb23054f39054ee48b5c87049fb7 /apps/files_versions/lib
parent0f3af00334fbfd748938a7cd65ad0982fbf9e67b (diff)
downloadnextcloud-server-eaddf3601252b9eeee3e25df6d26e6f3a867d897.tar.gz
nextcloud-server-eaddf3601252b9eeee3e25df6d26e6f3a867d897.zip
Improve path resolution in files_version hooks
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/files_versions/lib')
-rw-r--r--apps/files_versions/lib/Listener/FileEventsListener.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/apps/files_versions/lib/Listener/FileEventsListener.php b/apps/files_versions/lib/Listener/FileEventsListener.php
index 5fe41f76e49..206c75ec6ec 100644
--- a/apps/files_versions/lib/Listener/FileEventsListener.php
+++ b/apps/files_versions/lib/Listener/FileEventsListener.php
@@ -350,16 +350,24 @@ class FileEventsListener implements IEventListener {
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;