Skip to content

Commit 45c4525

Browse files
fix: add mjs mime type (fix: #4098) (#4108)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
1 parent 5aff143 commit 45c4525

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

.changes/mjs-mime-type.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri": patch
3+
"tauri-runtime": patch
4+
---
5+
6+
Fix `.mjs` not being recognised as a file extension for JavaScript files (`text/javascript`).

core/tauri-runtime/src/http/mime_type.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ impl MimeType {
5353
Some("js") => Self::Js,
5454
Some("json") => Self::Json,
5555
Some("jsonld") => Self::Jsonld,
56+
Some("mjs") => Self::Js,
5657
Some("rtf") => Self::Rtf,
5758
Some("svg") => Self::Svg,
5859
Some("mp4") => Self::Mp4,
@@ -115,6 +116,9 @@ mod tests {
115116
let jsonld: String = MimeType::parse_from_uri("https:/example.com/hello.jsonld").to_string();
116117
assert_eq!(jsonld, String::from("application/ld+json"));
117118

119+
let mjs: String = MimeType::parse_from_uri("https://example.com/bundled.mjs").to_string();
120+
assert_eq!(mjs, String::from("text/javascript"));
121+
118122
let rtf: String = MimeType::parse_from_uri("https://example.com/document.rtf").to_string();
119123
assert_eq!(rtf, String::from("application/rtf"));
120124

0 commit comments

Comments
 (0)