mirror of
https://github.com/nextcloud/server.git
synced 2026-06-05 06:44:47 -04:00
Merge pull request #42926 from nextcloud/backport/42891/stable27
[stable27] Improve path resolution in files_version hooks
This commit is contained in:
commit
87b75fcc5d
1 changed files with 10 additions and 2 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue