Commit 2941a96
Fix .mjs files served with wrong MIME type (#5724)
### Motivation
Fixes #5723, which boils down to how in Windows, `mimetypes` respect the
Windows registry.
As such under a system with `.mjs` override `Content Type` as
`text/plain`, JavaScript ES modules (`.mjs` files) like `dompurify.mjs`
were being served with MIME type `text/plain` instead of
`text/javascript`.
Compliant browsers will reject them due to strict MIME type checking for
module scripts.
### Implementation
Register the `.mjs` extension with the correct `text/javascript` MIME
type, similar to how `.js` files are already registered.
### Progress
- [x] I chose a meaningful title that completes the sentence: "If
applied, this PR will..."
- [x] The implementation is complete.
- [x] If this PR addresses a security issue, it has been coordinated via
the [security
advisory](https://github.com/zauberzeug/nicegui/security/advisories/new)
process.
- [x] Pytests have been added (or are not necessary).
- [x] Documentation has been added (or is not necessary).
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent fd18ca1 commit 2941a96
2 files changed
+5
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
| |||
0 commit comments