Call end() when handing ERR_STREAM_PREMATURE_CLOSE

This commit is contained in:
Simon Detheridge 2020-03-30 15:03:09 +01:00
parent ae62bb75ca
commit 4cb4d450be

View file

@ -61,7 +61,9 @@ function getFile(req, res, next) {
}
pipeline(fileStream, res, err => {
if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
if (err && err.code === 'ERR_STREAM_PREMATURE_CLOSE') {
res.end()
} else if (err) {
next(
new Errors.ReadError({
message: 'error transferring stream',