Handle ERR_STREAM_UNABLE_TO_PIPE alongside ERR_STREAM_PREMATURE_CLOSE (#31174)

GitOrigin-RevId: bbf49237b177d7a58a9b13efc6f38f5eecfb745c
This commit is contained in:
Anna Claire Fields
2026-02-02 11:12:52 +01:00
committed by Copybot
parent a591f2eb7a
commit ee4b5f515c
8 changed files with 29 additions and 8 deletions

View File

@@ -68,7 +68,11 @@ 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' ||
err.code === 'ERR_STREAM_UNABLE_TO_PIPE')
) {
res.end()
} else if (err) {
next(