Skip to content

Commit

Permalink
fix: Get Proper Node object when creating GroupVersion
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge authored and backportbot[bot] committed Jun 6, 2024
1 parent 1adb313 commit 3eba871
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/Versions/VersionsBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,18 @@ private function getVersionsForFileFromDB(FileInfo $fileInfo, IUser $user): arra
$folderId = $this->getFolderIdForFile($fileInfo);
$mountPoint = $fileInfo->getMountPoint();
$versionsFolder = $this->getVersionFolderForFile($fileInfo);
/** @var Folder */
$groupFolder = $this->rootFolder->get('/__groupfolders/' . $folderId);

$versionEntities = $this->groupVersionsMapper->findAllVersionsForFileId($fileInfo->getId());
$mappedVersions = array_map(
function (GroupVersionEntity $versionEntity) use ($versionsFolder, $mountPoint, $fileInfo, $user, $folderId) {
function (GroupVersionEntity $versionEntity) use ($versionsFolder, $mountPoint, $fileInfo, $user, $folderId, $groupFolder) {
if ($fileInfo->getMtime() === $versionEntity->getTimestamp()) {
$versionFile = $fileInfo;
if ($fileInfo instanceof File) {
$versionFile = $fileInfo;
} else {
$versionFile = $groupFolder->get($fileInfo->getInternalPath());
}
} else {
try {
$versionFile = $versionsFolder->get((string)$versionEntity->getTimestamp());
Expand Down

0 comments on commit 3eba871

Please sign in to comment.