mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
history-v1: handle ERR_STREAM_PREMATURE_CLOSE in streamZip (#36135)
GitOrigin-RevId: 963b65583da58034afe304206f6e0c66e9186b06
This commit is contained in:
committed by
Copybot
parent
d9e7900246
commit
b8339c5b4a
@@ -320,7 +320,18 @@ async function streamZip(snapshot, blobStore, res) {
|
||||
res.set('Content-Type', 'application/octet-stream')
|
||||
res.set('Content-Disposition', 'attachment; filename=project.zip')
|
||||
const stream = fs.createReadStream(tmpFilename)
|
||||
await pipeline(stream, res)
|
||||
try {
|
||||
await pipeline(stream, res)
|
||||
} catch (err) {
|
||||
if (
|
||||
err?.code === 'ERR_STREAM_PREMATURE_CLOSE' ||
|
||||
err?.code === 'ERR_STREAM_UNABLE_TO_PIPE'
|
||||
) {
|
||||
res.end()
|
||||
} else {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user