Skip to content

Commit

Permalink
Merge pull request #3186 from nextcloud/backport/3183/stable29
Browse files Browse the repository at this point in the history
[stable29] fix(versions): Handle missing versions folder
  • Loading branch information
artonge authored Sep 10, 2024
2 parents c5449f6 + b51325a commit 75d5aaa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Versions/VersionsBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,12 @@ private function getFolderIdForFile(FileInfo $file): int {

public function getVersionFolderForFile(FileInfo $file): Folder {
$folderId = $this->getFolderIdForFile($file);
$groupfoldersVersionsFolder = $this->getVersionsFolder($folderId);

try {
$groupfoldersVersionsFolder = $this->getVersionsFolder($folderId);
/** @var Folder $versionsFolder */
return $groupfoldersVersionsFolder->get((string)$file->getId());
$versionsFolder = $groupfoldersVersionsFolder->get((string)$file->getId());
return $versionsFolder;
} catch (NotFoundException $e) {
// The folder for the file's versions might not exists if no versions has been create yet.
return $groupfoldersVersionsFolder->newFolder((string)$file->getId());
Expand Down

0 comments on commit 75d5aaa

Please sign in to comment.