aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2024-02-16 11:55:06 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-03-16 12:26:12 +0000
commit3263de77f2d4fb53f0c95325616b158f848e7513 (patch)
treeb6f0bb6a09785544fda62c5e3e84dfa3a6d4a0be /apps/files_versions
parent92e43540ba80c773dcc1e2f02a1ee0d6feea993c (diff)
downloadnextcloud-server-3263de77f2d4fb53f0c95325616b158f848e7513.tar.gz
nextcloud-server-3263de77f2d4fb53f0c95325616b158f848e7513.zip
fix: fallback from guessing the owner from path in versioning
Signed-off-by: Robin Appelman <robin@icewind.nl>
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 f199d47b981..b5ac075c781 100644
--- a/apps/files_versions/lib/Listener/FileEventsListener.php
+++ b/apps/files_versions/lib/Listener/FileEventsListener.php
@@ -361,6 +361,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)