Skip to content

Commit

Permalink
Merge pull request #44247 from nextcloud/backport/43613/stable27
Browse files Browse the repository at this point in the history
[stable27] fix: fallback from guessing the owner from path in versioning
  • Loading branch information
susnux authored Mar 16, 2024
2 parents 670ab9e + 86858b7 commit 7773cbb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions apps/files_versions/lib/Listener/FileEventsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,16 @@ private function getPathForNode(Node $node): ?string {
}

$owner = $node->getOwner()?->getUid();

// If no owner, extract it from the path.
// e.g. /user/files/foobar.txt
if (!$owner) {
$parts = explode('/', $node->getPath(), 4);
if (count($parts) === 4) {
$owner = $parts[1];
}
}

if ($owner) {
$path = $this->rootFolder
->getUserFolder($owner)
Expand Down

0 comments on commit 7773cbb

Please sign in to comment.