Skip to content

Commit

Permalink
Merge pull request #3023 from nextcloud/backport/3022/stable28
Browse files Browse the repository at this point in the history
[stable28] fix: Get Proper Node object when creating GroupVersion
  • Loading branch information
artonge authored Jun 21, 2024
2 parents f711294 + 62d34f1 commit ecdc0c5
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 @@ -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());
Expand Down

0 comments on commit ecdc0c5

Please sign in to comment.