Skip to content

fix(utils/mime): Normalize input extension to lowercase before MIME check#4800

Merged
yusukebe merged 1 commit intohonojs:mainfrom
TheEssem:fix/lower-mime-ext
Mar 11, 2026
Merged

fix(utils/mime): Normalize input extension to lowercase before MIME check#4800
yusukebe merged 1 commit intohonojs:mainfrom
TheEssem:fix/lower-mime-ext

Conversation

@TheEssem
Copy link
Copy Markdown
Contributor

When a filename with an upper/mixed-case extension is provided to getMimeType, it currently returns an undefined value which causes the static middleware to return a Content-Type of application/octet-stream. This PR normalizes upper/mixed-case file extensions during the check so that they can be properly matched to the MIME type map.

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.83%. Comparing base (b0aba5b) to head (9b8da30).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4800   +/-   ##
=======================================
  Coverage   92.83%   92.83%           
=======================================
  Files         177      177           
  Lines       11633    11633           
  Branches     3465     3464    -1     
=======================================
  Hits        10799    10799           
  Misses        833      833           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yusukebe
Copy link
Copy Markdown
Member

@TheEssem Thanks! Good fix.

@yusukebe yusukebe merged commit 488ea6a into honojs:main Mar 11, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants