Repository navigation
Commit cc041e5
authored
fix(node): don't crash on Bun when encoding an empty-named File (#98)
Running the node adapter on Bun could crash while sending a file. It
happened when a request's `content-disposition: attachment; filename=""`
came back out as a response. Bun gives an empty-named `File` a `name` of
`undefined`, so `generateContentDisposition` threw before any headers
were sent. The fetch and peer adapters already fall back to `''`, and
now the node adapter does too.
## Fixes
- Empty-named files now encode on Bun instead of throwing, so the node
adapter handles them the same way as fetch and peer.
## Testing
- Added a regression test that simulates Bun's `undefined` file name. It
fails without the fix and passes with it. The node body suite passes
(34/34), and lint and type-check are clean.
- Note: the Bun runtime suite in `tests/bun` only covers the fetch and
peer adapters, which is why this wasn't caught earlier.1 parent 7b35a15 commit cc041e5
2 files changed
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
550 | 565 | | |
551 | 566 | | |
552 | 567 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
| 119 | + | |
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
| |||
0 commit comments