mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
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:
@@ -63,6 +63,7 @@ module.exports = DiffGenerator = {
|
||||
if (p > max_p) {
|
||||
logger.warn({ max_p, p }, 'truncating position to content length')
|
||||
p = max_p
|
||||
op.p = p // fix out of range offsets to avoid invalid history exports in ZipManager
|
||||
}
|
||||
|
||||
const textToBeRemoved = content.slice(p, p + op.i.length)
|
||||
@@ -74,6 +75,9 @@ module.exports = DiffGenerator = {
|
||||
|
||||
return content.slice(0, p) + content.slice(p + op.i.length)
|
||||
} else if (op.d != null) {
|
||||
if (op.p > content.length) {
|
||||
op.p = content.length // fix out of range offsets to avoid invalid history exports in ZipManager
|
||||
}
|
||||
return content.slice(0, op.p) + op.d + content.slice(op.p)
|
||||
} else {
|
||||
return content
|
||||
|
||||
Reference in New Issue
Block a user