aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLouis <louis@chmn.me>2024-01-18 13:59:35 +0100
committerGitHub <noreply@github.com>2024-01-18 13:59:35 +0100
commit87b75fcc5d2e2ec90d0879353095a94a2a44c46b (patch)
treeaf2a27556870a903d9c75090e2b310e7cb20ba1e /apps
parent82fce120719d002ba0fa7d2f853652fd889130f1 (diff)
parent91c8e790babb903e547975364ca39defcf781eee (diff)
downloadnextcloud-server-87b75fcc5d2e2ec90d0879353095a94a2a44c46b.tar.gz
nextcloud-server-87b75fcc5d2e2ec90d0879353095a94a2a44c46b.zip
Merge pull request #42926 from nextcloud/backport/42891/stable27
[stable27] Improve path resolution in files_version hooks
Diffstat (limited to 'apps')
-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;