From 22177fa457088401586f320c4d2612fdb36929c7 Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Mon, 16 Mar 2026 13:00:36 -0500 Subject: [PATCH] Fix range header parsing Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com> --- app/attachment_channel.main.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/attachment_channel.main.ts b/app/attachment_channel.main.ts index 2b70c77e82..19b8991347 100644 --- a/app/attachment_channel.main.ts +++ b/app/attachment_channel.main.ts @@ -791,15 +791,12 @@ function handleRangeRequest({ } // Chromium only sends open-ended ranges: "start-" - type Match = RegExpMatchArray & { 1: string }; const match = range.match(/^bytes=(\d+)-$/); - if (match == null) { + if (match == null || match[1] == null) { log.error(`invalid range header: ${range}`); return create200Response(); } - - const [startInput] = match as Match; - const startParam = safeParseInteger(startInput); + const startParam = safeParseInteger(match[1]); if (startParam == null) { log.error(`invalid range header: ${range}`); return create200Response();