From aa455d13cc0a819cfc8707917a98b23c7b27420a Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 10 Feb 2026 04:29:07 +0000 Subject: [PATCH] Allow optional spaces in Range header parsing Co-authored-by: Theo Browne --- apps/t3/src/cli.test.ts | 7 +++++++ apps/t3/src/cli.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/t3/src/cli.test.ts b/apps/t3/src/cli.test.ts index b4e21bfb1b..47aac941ba 100644 --- a/apps/t3/src/cli.test.ts +++ b/apps/t3/src/cli.test.ts @@ -928,6 +928,13 @@ describe("parseByteRangeHeader", () => { }); }); + it("tolerates optional whitespace around separators", () => { + expect(parseByteRangeHeader("bytes = 0 - 9", 100)).toEqual({ + start: 0, + end: 9, + }); + }); + it("parses case-insensitive byte-unit prefixes", () => { expect(parseByteRangeHeader("ByTeS=0-9", 100)).toEqual({ start: 0, diff --git a/apps/t3/src/cli.ts b/apps/t3/src/cli.ts index 849ed2d8ca..e55a35f31b 100644 --- a/apps/t3/src/cli.ts +++ b/apps/t3/src/cli.ts @@ -661,7 +661,7 @@ export function parseByteRangeHeader( return "invalid"; } - const match = rangeHeaderValue.trim().match(/^bytes=(\d*)-(\d*)$/i); + const match = rangeHeaderValue.trim().match(/^bytes\s*=\s*(\d*)\s*-\s*(\d*)$/i); if (!match) { return "invalid"; }