aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-03-16 13:23:06 +0100
committerGitHub <noreply@github.com>2024-03-16 13:23:06 +0100
commit2ff172004a6f9137e948f23fc9838ada0a025828 (patch)
tree7baa163fa3c933e31dbd58c5e06fcce0fd77acf1 /apps/files_versions
parente2f08d97489e7e18680c455cbc0dac2bd765c64d (diff)
parent1125cf7afc31dec044b308cac583fbcf40fcb719 (diff)
downloadnextcloud-server-2ff172004a6f9137e948f23fc9838ada0a025828.tar.gz
nextcloud-server-2ff172004a6f9137e948f23fc9838ada0a025828.zip
Merge pull request #43613 from nextcloud/version-owner-fallback
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/Listener/FileEventsListener.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/files_versions/lib/Listener/FileEventsListener.php b/apps/files_versions/lib/Listener/FileEventsListener.php
index 84cffc2c1fd..24a21b22549 100644
--- a/apps/files_versions/lib/Listener/FileEventsListener.php
+++ b/apps/files_versions/lib/Listener/FileEventsListener.php
@@ -362,6 +362,16 @@ class FileEventsListener implements IEventListener {
}
$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)