aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2024-01-17 17:07:59 +0100
committerLouis Chemineau <louis@chmn.me>2024-01-17 17:17:51 +0100
commit51fa2e3b1918921b42283aac34bbca210ae8180e (patch)
tree6b3f6a7ff09f54b9be0f32c5f0bc9839a1399545 /apps/files_versions
parent5de3028f667afb807d1c682238340208e56d6b91 (diff)
downloadnextcloud-server-51fa2e3b1918921b42283aac34bbca210ae8180e.tar.gz
nextcloud-server-51fa2e3b1918921b42283aac34bbca210ae8180e.zip
Improve path resolution in files_version hooks
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/files_versions')
-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;