diff --git a/apps/files_versions/lib/Listener/FileEventsListener.php b/apps/files_versions/lib/Listener/FileEventsListener.php index c078f4bc34755..aa70aa80ebd36 100644 --- a/apps/files_versions/lib/Listener/FileEventsListener.php +++ b/apps/files_versions/lib/Listener/FileEventsListener.php @@ -361,9 +361,10 @@ 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) { + // If no owner, extract it from the path, e.g. /user/files/foobar.txt + // Also try this if they are the same, because it might be a group folder that the user does not have access to + // E.g. where filling in a form with a spreadsheet attached + if (!$owner || $owner == $user) { $parts = explode('/', $node->getPath(), 4); if (count($parts) === 4) { $owner = $parts[1];