[PR #6592] fix(server): handle query params in MIME type detection for proxied assets #11990

Closed
opened 2026-02-16 18:16:55 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/6592

State: closed
Merged: No


Summary

Improves upon #6587 by fixing a bug where MIME type detection fails for URLs with query parameters or hash fragments.

Problem

The current implementation (from #6587) uses path.endsWith(ext) which fails for:

  • /assets/file.js?v=123 - common for cache busting
  • /assets/file.js#source-map - used in source maps
    This causes these files to be served without Content-Type headers, breaking module loading.

Changes

  • Extract pathname without query params/hash before extension checking
  • Add charset=utf-8 to text-based MIME types (JS, CSS, JSON) for standards compliance
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/6592 **State:** closed **Merged:** No --- ## Summary Improves upon #6587 by fixing a bug where MIME type detection fails for URLs with query parameters or hash fragments. ## Problem The current implementation (from #6587) uses `path.endsWith(ext)` which fails for: - `/assets/file.js?v=123` - common for cache busting - `/assets/file.js#source-map` - used in source maps This causes these files to be served without Content-Type headers, breaking module loading. ## Changes - Extract pathname without query params/hash before extension checking - Add `charset=utf-8` to text-based MIME types (JS, CSS, JSON) for standards compliance
yindo added the pull-request label 2026-02-16 18:16:55 -05:00
yindo closed this issue 2026-02-16 18:16:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11990