mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-11 19:01:18 +00: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,9 +61,11 @@ function getFile(req, res, next) {
|
|||
}
|
||||
|
||||
pipeline(fileStream, res, err => {
|
||||
if (err && err.code === 'ERR_STREAM_PREMATURE_CLOSE') {
|
||||
if (err) {
|
||||
fileStream.destroy()
|
||||
if (err.code === 'ERR_STREAM_PREMATURE_CLOSE') {
|
||||
res.end()
|
||||
} else if (err) {
|
||||
} else {
|
||||
next(
|
||||
new Errors.ReadError({
|
||||
message: 'error transferring stream',
|
||||
|
@ -71,6 +73,7 @@ function getFile(req, res, next) {
|
|||
}).withCause(err)
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue