Ensure Content-Type is always provided for js modules#2014
Conversation
|
Hello @Lord-Grey 👋 I'm the Hyperion Project Bot and I want to thank you for To help you and other users test your pull requests faster, 🔗 https://github.com/hyperion-project/hyperion.ng/actions/runs/25852229128 Of course, if you make changes to your PR, I will create a new link. Best regards, |
There was a problem hiding this comment.
Pull request overview
Fixes a WebUI bug where static JavaScript modules were served without a valid Content-Type header, causing browsers to block them due to disallowed MIME type. The fix introduces a helper that falls back to text/javascript for .js/.mjs/.cjs files (and application/octet-stream otherwise) when QMimeDatabase fails to resolve a usable MIME type, while preserving the existing QTBUG-97392 workaround for HTML files.
Changes:
- Extracted MIME resolution into a
resolveMimeTypehelper with JS extension fallback and defaultapplication/octet-stream. - Narrowed the QTBUG-97392 HTML workaround to only the affected Qt version ranges.
- Updated CHANGELOG.md with the fix entry and corrected a typo on the prior line.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| libsrc/webserver/StaticFileServing.cpp | Adds resolveMimeType helper providing fallback Content-Type for JS modules and unknown types. |
| CHANGELOG.md | Adds changelog entry for the fix and corrects "incomptible" → "incompatible". |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
🔧 Changed
What kind of change does this PR introduce? (check at least one)
If changing the UI of web configuration, please provide the before/after screenshot:
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing setups:
The PR fulfills these requirements:
Fixes: #xxx[,#xxx], where "xxx" is the issue number)If adding a new feature, the PR's description includes:
PLEASE DON'T FORGET TO ADD YOUR CHANGES TO CHANGELOG.MD
To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.
Other information:
Fixes: #1999