Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Revert "[stable27] fix(files_versions): don't call getUid() on null"
  • Loading branch information
blizzz authored Nov 20, 2023
commit 5103669ff8fc1920b4ad2e26f2b85e8baeeff207
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())

Check notice

Code scanning / Psalm

PossiblyNullReference

Cannot call method getUid on possibly null value
->getRelativePath($node->getPath());
}
}
Expand Down