mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Destroy file-download stream on error
This commit is contained in:
parent
4cb4d450be
commit
87b8f8e194
1 changed files with 12 additions and 9 deletions
|
@ -61,15 +61,18 @@ function getFile(req, res, next) {
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline(fileStream, res, err => {
|
pipeline(fileStream, res, err => {
|
||||||
if (err && err.code === 'ERR_STREAM_PREMATURE_CLOSE') {
|
if (err) {
|
||||||
res.end()
|
fileStream.destroy()
|
||||||
} else if (err) {
|
if (err.code === 'ERR_STREAM_PREMATURE_CLOSE') {
|
||||||
next(
|
res.end()
|
||||||
new Errors.ReadError({
|
} else {
|
||||||
message: 'error transferring stream',
|
next(
|
||||||
info: { bucket, key, format, style }
|
new Errors.ReadError({
|
||||||
}).withCause(err)
|
message: 'error transferring stream',
|
||||||
)
|
info: { bucket, key, format, style }
|
||||||
|
}).withCause(err)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue