diff options
-rw-r--r-- | apps/files_versions/lib/Listener/FileEventsListener.php | 10 |
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) |