Merge pull request #12121 from overleaf/bg-fix-bad-offsets-in-history-migration

fix out of range offsets to avoid invalid history exports

GitOrigin-RevId: d00e3e9e08feb6c3be671b5805102a66782b3f92
This commit is contained in:
Brian Gough
2023-03-08 09:04:00 +00:00
committed by Copybot
parent 1f2c06b1d0
commit 9276ba87b2
3 changed files with 34 additions and 1 deletions
@@ -107,6 +107,15 @@ async function upgradeProject(project, options) {
if (!upgradeFn) {
return { error: 'unsupported history type' }
}
if (options.forceClean) {
try {
const projectId = project._id
// delete any existing history stored in the mongo backend
await HistoryManager.promises.deleteProject(projectId, projectId)
} catch (err) {
// failed to delete existing history, but we can try to continue
}
}
const result = await upgradeFn(project, options)
result.historyType = historyType
return result