Skip to content

Commit

Permalink
Merge pull request #42926 from nextcloud/backport/42891/stable27
Browse files Browse the repository at this point in the history
[stable27] Improve path resolution in files_version hooks
  • Loading branch information
artonge committed Jan 18, 2024
2 parents 82fce12 + 91c8e79 commit 87b75fc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/files_versions/lib/Listener/FileEventsListener.php
Expand Up @@ -350,16 +350,24 @@ public function pre_renameOrCopy_hook(Node $source, Node $target): void {
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;
Expand Down

0 comments on commit 87b75fc

Please sign in to comment.