Skip to content

Commit

Permalink
Merge pull request #42921 from nextcloud/backport/42891/stable28
Browse files Browse the repository at this point in the history
[stable28] Improve path resolution in files_version hooks
  • Loading branch information
blizzz authored Jan 18, 2024
2 parents 1fc8978 + eaddf36 commit ddb95ce
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/files_versions/lib/Listener/FileEventsListener.php
Original file line number Diff line number Diff line change
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 ddb95ce

Please sign in to comment.