Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: Delete ghost versions of non-existing files
Signed-off-by: Git'Fellow <[email protected]>
  • Loading branch information
solracsf authored and blizzz committed Dec 4, 2023
commit de7e4e1612ae7f61c59d2a35b1ef9864e7e52331
5 changes: 4 additions & 1 deletion apps/files_versions/lib/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -592,14 +592,17 @@ public static function expireOlderThanMaxForUser($uid) {
throw new DoesNotExistException('Could not find relative path of (' . $info->getPath() . ')');
}

$node = $userFolder->get(substr($path, 0, -strlen('.v'.$version)));
try {
$node = $userFolder->get(substr($path, 0, -strlen('.v'.$version)));
$versionEntity = $versionsMapper->findVersionForFileId($node->getId(), $version);
$versionEntities[$info->getId()] = $versionEntity;

if ($versionEntity->getLabel() !== '') {
return false;
}
} catch (NotFoundException $e) {
// Original node not found, delete the version
return true;
} catch (DoesNotExistException $ex) {
// Version on FS can have no equivalent in the DB if they were created before the version naming feature.
// So we ignore DoesNotExistException.
Expand Down