Take the native blob path for Response-wrapped Bun.file() streams - #31674
Open
alii wants to merge 22 commits into
Open
Take the native blob path for Response-wrapped Bun.file() streams#31674alii wants to merge 22 commits into
alii wants to merge 22 commits into
Claude / Claude Code Review
completed
Jun 2, 2026 in 34m 32s
Code review found 1 important issue
Found 1 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 1 |
| 🟡 Nit | 0 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🔴 Important | src/runtime/server/RequestContext.rs:2407-2412 |
HEAD on sliced file-stream Response reports wrong Content-Length |
Annotations
Check failure on line 2412 in src/runtime/server/RequestContext.rs
claude / Claude Code Review
HEAD on sliced file-stream Response reports wrong Content-Length
The HEAD-parity fix in 9844fd77 routes `new Response(Bun.file(p).slice(a,b).stream())` through the `Value::Blob` arm, which calls `blob.resolve_size()` — and `resolve_size()`'s File arm unconditionally clobbers the slice's concrete `size` with `store_size - offset`. So for a 1 MiB file with `.slice(100, 1124)`, HEAD now emits `Content-Length: 1048476` while GET (via `do_sendfile`, which saves `original_size` before stat) correctly emits `Content-Length: 1024` — the opposite of the HEAD↔GET parit
Loading