Skip to content

Commit

Permalink
fix: add mjs mime type (fix: #4098) (#4108)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
  • Loading branch information
meadowsys and lucasfernog committed May 13, 2022
1 parent 5aff143 commit 45c4525
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changes/mjs-mime-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri": patch
"tauri-runtime": patch
---

Fix `.mjs` not being recognised as a file extension for JavaScript files (`text/javascript`).
4 changes: 4 additions & 0 deletions core/tauri-runtime/src/http/mime_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ impl MimeType {
Some("js") => Self::Js,
Some("json") => Self::Json,
Some("jsonld") => Self::Jsonld,
Some("mjs") => Self::Js,
Some("rtf") => Self::Rtf,
Some("svg") => Self::Svg,
Some("mp4") => Self::Mp4,
Expand Down Expand Up @@ -115,6 +116,9 @@ mod tests {
let jsonld: String = MimeType::parse_from_uri("https:/example.com/hello.jsonld").to_string();
assert_eq!(jsonld, String::from("application/ld+json"));

let mjs: String = MimeType::parse_from_uri("https://example.com/bundled.mjs").to_string();
assert_eq!(mjs, String::from("text/javascript"));

let rtf: String = MimeType::parse_from_uri("https://example.com/document.rtf").to_string();
assert_eq!(rtf, String::from("application/rtf"));

Expand Down

0 comments on commit 45c4525

Please sign in to comment.