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
8 changes: 6 additions & 2 deletions apps/files_versions/lib/Listener/FileEventsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,20 @@ 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, use the node's owner.
* If no user is connected, try to 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($node->getOwner()->getUid())
->getUserFolder($owner->getUid())
->getRelativePath($node->getPath());
}
}
Expand Down