fix(scripts): ignore loose audit content length headers · openclaw/openclaw@906174b
vincentkoc
·
2026-06-19
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -729,8 +729,10 @@ async function withBulkAdvisoryTimeout({ label, timeoutMs, run }) {
|
729 | 729 | } |
730 | 730 | |
731 | 731 | async function readBoundedResponseText(response, maxBytes, label) { |
732 | | -const contentLength = Number.parseInt(response.headers?.get?.("content-length") ?? "", 10); |
733 | | -if (Number.isFinite(contentLength) && contentLength > maxBytes) { |
| 732 | +const rawContentLength = response.headers?.get?.("content-length"); |
| 733 | +const contentLength = |
| 734 | +rawContentLength && /^\d+$/u.test(rawContentLength) ? Number(rawContentLength) : undefined; |
| 735 | +if (Number.isSafeInteger(contentLength) && contentLength > maxBytes) { |
734 | 736 | await response.body?.cancel().catch(() => undefined); |
735 | 737 | throw Object.assign(new Error(`${label} exceeded ${maxBytes} bytes`), { code: "ETOOBIG" }); |
736 | 738 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。