mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-09-12 21:58:57 +02:00
fix: close streaming responses after upstream errors
This commit is contained in:
@@ -172,10 +172,10 @@ async function webView(req: express.Request, res: express.Response) {
|
||||
const html = `<!DOCTYPE html><html><head><title>Content</title></head><link rel="stylesheet" href="/css/all.min.css" /><body><div class="container p-3 file-content markdown-body">${body}</div></body></html>`;
|
||||
res.contentType("text/html").send(html);
|
||||
} catch {
|
||||
f.send(res);
|
||||
await f.send(res);
|
||||
}
|
||||
} else {
|
||||
f.send(res);
|
||||
await f.send(res);
|
||||
}
|
||||
} catch (error) {
|
||||
handleError(error, res, req);
|
||||
|
||||
@@ -39,6 +39,7 @@ router.post(
|
||||
);
|
||||
} catch (error) {
|
||||
handleError(error, res);
|
||||
if (res.headersSent && !res.writableEnded) res.destroy();
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -111,6 +112,8 @@ router.post("/", async (req: express.Request, res: express.Response) => {
|
||||
content.destroy();
|
||||
}
|
||||
handleError(error, res);
|
||||
if (res.headersSent && !res.writableEnded) res.destroy();
|
||||
anonymizer.destroy();
|
||||
}
|
||||
content
|
||||
.on("error", handleStreamError)
|
||||
|
||||
Reference in New Issue
Block a user