summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
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:38:07 +0000
commit91c8e790babb903e547975364ca39defcf781eee (patch)
tree92d0b35137e82aff0bf688a344ee7ccde29e1aab /apps/files_versions
parent48ea4da227ff68c31f0912b5ae428d89be58dd2e (diff)
downloadnextcloud-server-91c8e790babb903e547975364ca39defcf781eee.tar.gz
nextcloud-server-91c8e790babb903e547975364ca39defcf781eee.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;