R2 Dashboard: JSON preview not working with Content-Type containing charset=utf-8

Type

New feature

Description

When uploading JSON files to R2, some tools (like Bun’s s3.write()) automatically append charset=utf-8 to the Content-Type (application/json;charset=utf-8). While this Content-Type is technically valid, it prevents the R2 Dashboard’s JSON preview functionality from working. The preview function seems to only work with the plain application/json Content-Type. This limitation affects developers who use various tools and SDKs that automatically include charset information in the Content-Type header, forcing them to either modify their upload logic or lose the convenience of the JSON preview feature.

Benefit

Enhancing the R2 Dashboard to support JSON preview for Content-Types with charset parameters would improve the user experience for many developers. Since UTF-8 is the default encoding for JSON (as per RFC 8259), supporting application/json;charset=utf-8 would maintain compatibility with more tools and SDKs while preserving the helpful preview functionality. This change would eliminate the need for developers to implement workarounds or lose the preview feature when using tools that automatically include charset information.

I also reported this issue to the Bun development team, but it was declined as they considered removing charset=utf-8 would be a breaking change. It would be greatly appreciated if the R2 Dashboard could handle this on their side.