File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
core/tauri-runtime-wry/src Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " tauri-runtime-wry " : patch
3+ " tauri " : patch
4+ ---
5+
6+ Fixes SVG loading on custom protocol.
Original file line number Diff line number Diff line change @@ -63,16 +63,18 @@ impl MimeType {
6363
6464 /// infer mimetype from content (or) URI if needed.
6565 pub fn parse ( content : & [ u8 ] , uri : & str ) -> String {
66- let mime = match infer:: get ( content) {
67- Some ( info) => info. mime_type ( ) ,
68- None => MIMETYPE_PLAIN ,
66+ let mime = if uri. ends_with ( ".svg" ) {
67+ // when reading svg, we can't use `infer`
68+ None
69+ } else {
70+ infer:: get ( content) . map ( |info| info. mime_type ( ) )
6971 } ;
7072
71- if mime == MIMETYPE_PLAIN {
72- return Self :: parse_from_uri ( uri) . to_string ( ) ;
73+ match mime {
74+ Some ( mime) if mime == MIMETYPE_PLAIN => Self :: parse_from_uri ( uri) . to_string ( ) ,
75+ None => Self :: parse_from_uri ( uri) . to_string ( ) ,
76+ Some ( mime) => mime. to_string ( ) ,
7377 }
74-
75- mime. to_string ( )
7678 }
7779}
7880
You can’t perform that action at this time.
0 commit comments