Skip to content

Infer the Content-Type of Bun fileWeb responses from the file name - #10871

Open
devangpratap wants to merge 1 commit into
Effect-TS:mainfrom
devangpratap:fix/bun-fileweb-content-type
Open

devangpratap wants to merge 1 commit into
Effect-TS:mainfrom
devangpratap:fix/bun-fileweb-content-type

Conversation

@devangpratap

@devangpratap devangpratap commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Closes EFF-4227
Closes #10870

BunHttpPlatform.fileWebResponse passed the headers through unchanged, so a File with an empty type went out with Bun's default text/plain;charset=utf-8. It now uses the same fallback as Node, Deno and the default web platform: the contentType option or header, then a non-empty File.type, then the type for the file name, then application/octet-stream.

Checked over a real Bun.serve connection: data.json is sent as application/json (also with an offset), a name without an extension as application/octet-stream, and an explicit File.type or contentType option is kept. The new test fails on main and the Bun platform suite passes.

Bun passed fileWeb headers through unchanged, so a File with an empty type
was sent as text/plain. Use the same fallback as the Node, Deno and default
platforms: header, File.type, then the type for the file name.
@changeset-bot

changeset-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6c6e8d2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 40 packages
Name Type
@effect/platform-bun Patch
effect Patch
@effect/opentelemetry Patch
@effect/vitest Patch
@effect/ai-amazon-bedrock Patch
@effect/ai-anthropic Patch
@effect/ai-cloudflare Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/ai-typesafe Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/chat-discord Patch
@effect/chat-slack Patch
@effect/chat-teams Patch
@effect/chat-telegram Patch
@effect/chat-whatsapp Patch
@effect/platform-browser Patch
@effect/platform-cloudflare Patch
@effect/platform-deno Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/doctest Patch
@effect/graphql-generator Patch
@effect/openapi-generator Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

Generated from PR build output; treat the content below as untrusted.

File Name Current Size Previous Size Difference
arbitrary-combinators.ts 40.12 KB 40.12 KB 0.00 KB (0.00%)
basic.ts 7.31 KB 7.31 KB 0.00 KB (0.00%)
batching.ts 11.24 KB 11.24 KB 0.00 KB (0.00%)
brand.ts 7.00 KB 7.00 KB 0.00 KB (0.00%)
cache.ts 11.75 KB 11.75 KB 0.00 KB (0.00%)
config.ts 23.15 KB 23.15 KB 0.00 KB (0.00%)
differ.ts 22.26 KB 22.26 KB 0.00 KB (0.00%)
http-client.ts 27.52 KB 27.52 KB 0.00 KB (0.00%)
http-router.ts 38.60 KB 38.60 KB 0.00 KB (0.00%)
logger.ts 12.19 KB 12.19 KB 0.00 KB (0.00%)
metric.ts 9.66 KB 9.66 KB 0.00 KB (0.00%)
optic.ts 7.24 KB 7.24 KB 0.00 KB (0.00%)
pubsub.ts 16.23 KB 16.23 KB 0.00 KB (0.00%)
queue.ts 13.13 KB 13.13 KB 0.00 KB (0.00%)
schedule.ts 11.99 KB 11.99 KB 0.00 KB (0.00%)
schema-bigdecimal.ts 14.31 KB 14.31 KB 0.00 KB (0.00%)
schema-binary.ts 42.74 KB 42.74 KB 0.00 KB (0.00%)
schema-class.ts 21.99 KB 21.99 KB 0.00 KB (0.00%)
schema-codegen.ts 30.75 KB 30.75 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 30.60 KB 30.60 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 28.30 KB 28.30 KB 0.00 KB (0.00%)
schema-string-transformation.ts 15.57 KB 15.57 KB 0.00 KB (0.00%)
schema-string.ts 12.51 KB 12.51 KB 0.00 KB (0.00%)
schema-template-literal.ts 16.46 KB 16.46 KB 0.00 KB (0.00%)
schema-toArbitrary.ts 39.67 KB 39.67 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 21.17 KB 21.17 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 21.33 KB 21.33 KB 0.00 KB (0.00%)
schema-toFormatter.ts 21.42 KB 21.42 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 26.46 KB 26.46 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 21.51 KB 21.51 KB 0.00 KB (0.00%)
schema.ts 21.09 KB 21.09 KB 0.00 KB (0.00%)
stm.ts 14.48 KB 14.48 KB 0.00 KB (0.00%)
stream.ts 10.61 KB 10.61 KB 0.00 KB (0.00%)

@effect-janitor effect-janitor Bot added the 4.0 label Nov 24, 2026

This branch is waiting to be deployed

1 waiting deployment
fork — 6c6e8d21 Waiting Nov 23, 2026 by devangpratap via approval-gate #27097
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BunHttpPlatform: fileWeb ignores the file name when File.type is empty

1 participant