Skip to content

Commit

Permalink
Merge pull request #41612 from nextcloud/revert-41553-backport/41518/…
Browse files Browse the repository at this point in the history
…stable27

Revert "[stable27] fix(files_versions): don't call getUid() on null"
  • Loading branch information
blizzz committed Nov 22, 2023
2 parents 775703e + 5103669 commit 81e5453
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 @@ -351,20 +351,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 81e5453

Please sign in to comment.