Skip to content

Commit

Permalink
Merge pull request #41613 from nextcloud/revert-41552-backport/41518/…
Browse files Browse the repository at this point in the history
…stable26

Revert "[stable26] fix(files_versions): don't call getUid() on null"
  • Loading branch information
blizzz authored Nov 22, 2023
2 parents 115c542 + a4734e0 commit f470226
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions apps/files_versions/lib/Listener/FileEventsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,20 +349,16 @@ public function pre_renameOrCopy_hook(Node $source, Node $target): void {

/**
* Retrieve the path relative to the current user root folder.
* If no user is connected, try to use the node's owner.
* If no user is connected, use the node's owner.
*/
private function getPathForNode(Node $node): ?string {
try {
return $this->rootFolder
->getUserFolder(\OC_User::getUser())
->getRelativePath($node->getPath());
} catch (\Throwable $ex) {
$owner = $node->getOwner();
if ($owner === null) {
return null;
}
return $this->rootFolder
->getUserFolder($owner->getUid())
->getUserFolder($node->getOwner()->getUid())
->getRelativePath($node->getPath());
}
}
Expand Down

0 comments on commit f470226

Please sign in to comment.