mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #8501 from overleaf/bg-handle-broken-ops
[track-changes] handle broken ops when generating zip file GitOrigin-RevId: d90ee1f01bc191f39538588499f9a8983652964c
This commit is contained in:
parent
2bd7bb449f
commit
e11b504c5a
1 changed files with 7 additions and 3 deletions
|
@ -97,11 +97,15 @@ async function rewindDoc(projectId, docId, zipfile) {
|
|||
|
||||
const updatePath = `${id}/updates/${update.v}`
|
||||
|
||||
zipfile.addBuffer(Buffer.from(JSON.stringify(update)), updatePath, {
|
||||
mtime: new Date(update.meta.start_ts),
|
||||
})
|
||||
try {
|
||||
content = DiffGenerator.rewindUpdate(content, update)
|
||||
// filter out any known "broken ops" as these may be recoverable
|
||||
update.op = update.op.filter(op => !op.broken)
|
||||
// only store the update in the zip file when we have applied it
|
||||
// successfully, and after filtering out broken ops.
|
||||
zipfile.addBuffer(Buffer.from(JSON.stringify(update)), updatePath, {
|
||||
mtime: new Date(update.meta.start_ts),
|
||||
})
|
||||
v = update.v
|
||||
} catch (e) {
|
||||
e.attempted_update = update // keep a record of the attempted update
|
||||
|
|
Loading…
Reference in a new issue