Validate Content-Length header before parsing in EJS_Download class

This commit is contained in:
Michael Green 2026-01-17 17:45:30 +11:00
parent d9909fea89
commit 3d824853af

View File

@ -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
}