From 3d824853af1030004f8ec4ecdd61e917d00e382e Mon Sep 17 00:00:00 2001 From: Michael Green <84688932+michael-j-green@users.noreply.github.com> Date: Sat, 17 Jan 2026 17:45:30 +1100 Subject: [PATCH] Validate Content-Length header before parsing in EJS_Download class --- data/src/cache.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/data/src/cache.js b/data/src/cache.js index e9a4e46..b3230c3 100644 --- a/data/src/cache.js +++ b/data/src/cache.js @@ -113,7 +113,10 @@ class EJS_Download { let contentLength = 0; if (resp.headers.get("Content-Length")) { try { - contentLength = parseInt(resp.headers.get("Content-Length")); + const parsedContentLength = parseInt(resp.headers.get("Content-Length")); + if (!isNaN(parsedContentLength) && parsedContentLength > 0) { + contentLength = parsedContentLength; + } } catch (e) { // swallow any errors parseing content length }