Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable27] fix: Delete ghost versions of non-existing files #41296

Merged
merged 1 commit into from Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion apps/files_versions/lib/Storage.php
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