Skip to content

Commit 1125cf7

Browse files
icewind1991skjnldsv
authored andcommitted
fix: fallback from guessing the owner from path in versioning
Signed-off-by: Robin Appelman <[email protected]>
1 parent 7dd22b0 commit 1125cf7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

apps/files_versions/lib/Listener/FileEventsListener.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,16 @@ private function getPathForNode(Node $node): ?string {
367367
}
368368

369369
$owner = $node->getOwner()?->getUid();
370+
371+
// If no owner, extract it from the path.
372+
// e.g. /user/files/foobar.txt
373+
if (!$owner) {
374+
$parts = explode('/', $node->getPath(), 4);
375+
if (count($parts) === 4) {
376+
$owner = $parts[1];
377+
}
378+
}
379+
370380
if ($owner) {
371381
$path = $this->rootFolder
372382
->getUserFolder($owner)

0 commit comments

Comments
 (0)