fn MimeFromUrl(Url: &str) -> Option<&'static str>Expand description
Resolve the correct Content-Type for a request URL by its file extension.
The vendored tauri-plugin-localhost asset resolver sometimes reports
text/html for disk-served .js / .css assets, which breaks module
loading in the webview (the browser refuses JS with 'text/html' is not a valid JavaScript MIME type'). By pre-setting Content-Type in
on_request, we guarantee the right MIME for the extensions the workbench
actually loads; the patched plugin keeps our value instead of overwriting.
Fonts are listed explicitly. WKWebView is strict about font MIME types -
when the asset resolver falls back to application/octet-stream for a
.ttf (which infer does on some macOS versions because TrueType has
no magic header), the browser silently refuses to use the font and the
workbench renders icons as blank squares with no console error. The
codicon font is the visible symptom; KaTeX and Seti fonts under
/Static/Application/extensions/... follow the same path.
Returns None for unknown extensions so the plugin’s asset.mime_type
fallback still applies (images, WASM, etc.).