Merge pull request #42891 from nextcloud/artonge/fix/path_resolution_in_files_versions_hooks

Improve path resolution in files_version hooks
This commit is contained in:
Louis 2024-01-18 11:08:04 +01:00 committed by GitHub
commit 8314fc5d36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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;