Improve path resolution in files_version hooks

Signed-off-by: Louis Chemineau <louis@chmn.me>
This commit is contained in:
Louis Chemineau 2024-01-17 17:07:59 +01:00 committed by backportbot-nextcloud[bot]
parent 48ea4da227
commit 91c8e790ba

View file

@ -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;