Merge pull request #860 from tdurieux/fix/zip-proxy-errors

fix: abort ZIP responses when the streamer fails
This commit is contained in:
Thomas Durieux authored and GitHub committed 2026-10-07 13:23:26 +02:00
commit 61a155fd2e
2 files changed
+100 -1

No files matched your search

+6 -1
View File
@@ -112,10 +112,11 @@ router.get(
upstreamStatus,
upstreamBody: upstreamBody?.slice(0, 500),
url: config.STREAMER_ENTRYPOINT
? join(config.STREAMER_ENTRYPOINT, "api/zip")
? join(config.STREAMER_ENTRYPOINT, "api/download")
: undefined,
err: serializeError(err),
});
const streaming = res.headersSent;
handleError(
new AnonymousError(errCode, {
url: req.originalUrl,
@@ -124,6 +125,10 @@ router.get(
}),
res
);
// Once ZIP bytes have been sent, handleError cannot send JSON.
// Terminate the truncated response so the client reports failure
// instead of waiting forever for the ZIP's central directory.
if (streaming && !res.writableEnded) res.destroy();
});
reqStream.pipe(res);
res.on("close", () => {