From 62d34f10b9abcab6cad308b98ac80c6ed5029581 Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Fri, 21 Jun 2024 15:31:49 +0200 Subject: [PATCH] fix: Get Proper Node object when creating GroupVersion Signed-off-by: skjnldsv --- lib/Versions/VersionsBackend.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Versions/VersionsBackend.php b/lib/Versions/VersionsBackend.php index 1297e291b..a9dbbfd8b 100644 --- a/lib/Versions/VersionsBackend.php +++ b/lib/Versions/VersionsBackend.php @@ -137,12 +137,18 @@ private function getVersionsForFileFromDB(FileInfo $fileInfo, IUser $user, int $ /** @var Folder */ $folder = $this->appFolder->get((string)$folderId); $file = $folder->get($fileInfo->getInternalPath()); + /** @var Folder */ + $groupFolder = $this->rootFolder->get('/__groupfolders/' . $folderId); $versionEntities = $this->groupVersionsMapper->findAllVersionsForFileId($fileInfo->getId()); $mappedVersions = array_map( - function (GroupVersionEntity $versionEntity) use ($versionsFolder, $mountPoint, $file, $fileInfo, $user, $folderId) { + function (GroupVersionEntity $versionEntity) use ($versionsFolder, $mountPoint, $file, $fileInfo, $user, $folderId, $groupFolder) { if ($fileInfo->getMtime() === $versionEntity->getTimestamp()) { - $versionFile = $file; + if ($fileInfo instanceof File) { + $versionFile = $fileInfo; + } else { + $versionFile = $groupFolder->get($fileInfo->getInternalPath()); + } } else { try { $versionFile = $versionsFolder->get((string)$versionEntity->getTimestamp());