Skip to content

Commit

Permalink
Merge pull request #1028 from nextcloud/bugfix/noid/path-versions
Browse files Browse the repository at this point in the history
Properly cast file and groupfolder ids to strings when using them in paths
  • Loading branch information
juliusknorr authored Sep 1, 2020
2 parents 900b736 + a5b498f commit 76b4b05
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Versions/VersionsBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ public function createVersion(IUser $user, FileInfo $file) {

try {
/** @var Folder $versionFolder */
$versionFolder = $versionsFolder->get($file->getId());
$versionFolder = $versionsFolder->get((string)$file->getId());
} catch (NotFoundException $e) {
$versionFolder = $versionsFolder->newFolder($file->getId());
$versionFolder = $versionsFolder->newFolder((string)$file->getId());
}

$versionMount = $versionFolder->getMountPoint();
Expand Down Expand Up @@ -140,7 +140,7 @@ public function getVersionFile(IUser $user, FileInfo $sourceFile, $revision): Fi
if ($mount instanceof GroupMountPoint) {
try {
/** @var Folder $versionsFolder */
$versionsFolder = $this->getVersionsFolder($mount->getFolderId())->get($sourceFile->getId());
$versionsFolder = $this->getVersionsFolder($mount->getFolderId())->get((string)$sourceFile->getId());
return $versionsFolder->get((string)$revision);
} catch (NotFoundException $e) {
return null;
Expand Down Expand Up @@ -196,7 +196,7 @@ private function getVersionsFolder(int $folderId) {
} catch (NotFoundException $e) {
/** @var Folder $trashRoot */
$trashRoot = $this->appFolder->nodeExists('versions') ? $this->appFolder->get('versions') : $this->appFolder->newFolder('versions');
return $trashRoot->newFolder($folderId);
return $trashRoot->newFolder((string)$folderId);
}
}
}

0 comments on commit 76b4b05

Please sign in to comment.