@@ -41,7 +41,7 @@ pub mod forgiving_base64;
4141pub mod mime;
4242
4343pub struct DataUrl < ' a > {
44- mime_type : mime :: Mime ,
44+ mime_type : String ,
4545 base64 : bool ,
4646 encoded_body_plus_fragment : & ' a str ,
4747}
@@ -87,7 +87,7 @@ impl<'a> DataUrl<'a> {
8787 } )
8888 }
8989
90- pub fn mime_type ( & self ) -> & mime :: Mime {
90+ pub fn mime_type ( & self ) -> & String {
9191 & self . mime_type
9292 }
9393
@@ -190,7 +190,7 @@ fn find_comma_before_fragment(after_colon: &str) -> Option<(&str, &str)> {
190190 None
191191}
192192
193- fn parse_header ( from_colon_to_comma : & str ) -> ( mime :: Mime , bool ) {
193+ fn parse_header ( from_colon_to_comma : & str ) -> ( String , bool ) {
194194 // "Strip leading and trailing ASCII whitespace"
195195 // \t, \n, and \r would have been filtered by the URL parser
196196 // \f percent-encoded by the URL parser
@@ -230,15 +230,7 @@ fn parse_header(from_colon_to_comma: &str) -> (mime::Mime, bool) {
230230 }
231231 }
232232
233- // FIXME: does Mime::from_str match the MIME Sniffing Standard’s parsing algorithm?
234- // <https://mimesniff.spec.whatwg.org/#parse-a-mime-type>
235- let mime_type = string. parse ( ) . unwrap_or_else ( |_| mime:: Mime {
236- type_ : String :: from ( "text" ) ,
237- subtype : String :: from ( "plain" ) ,
238- parameters : vec ! [ ( String :: from( "charset" ) , String :: from( "US-ASCII" ) ) ] ,
239- } ) ;
240-
241- ( mime_type, base64)
233+ ( string, base64)
242234}
243235
244236/// None: no base64 suffix
0 commit comments