mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #10246 from overleaf/jpa-pdf-caching-object-id-back-fill
[web] pdf-caching: double down on back-filling of object-id GitOrigin-RevId: 751392dc5ed59eb621eca3813040c7b92ef1369e
This commit is contained in:
parent
1a434558d7
commit
6f00659865
1 changed files with 12 additions and 3 deletions
|
@ -125,10 +125,19 @@ function backFillObjectContext(chunk, arrayBuffer) {
|
|||
return new Uint8Array(arrayBuffer)
|
||||
}
|
||||
const { size, objectId } = chunk
|
||||
const header = Uint8Array.from(objectId)
|
||||
const fullBuffer = new Uint8Array(size)
|
||||
fullBuffer.set(header, 0)
|
||||
fullBuffer.set(new Uint8Array(arrayBuffer), objectId.length)
|
||||
const sourceBuffer = new Uint8Array(arrayBuffer)
|
||||
try {
|
||||
fullBuffer.set(objectId, 0)
|
||||
fullBuffer.set(sourceBuffer, objectId.byteLength)
|
||||
} catch (err) {
|
||||
throw OError.tag(err, 'broken back-filling of object-id', {
|
||||
objectIdByteLength: objectId.byteLength,
|
||||
fullBufferByteLength: fullBuffer.byteLength,
|
||||
arrayBufferByteLength: arrayBuffer.byteLength,
|
||||
sourceBufferByteLength: sourceBuffer.byteLength,
|
||||
})
|
||||
}
|
||||
return fullBuffer
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue