File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
impit/src/response_parsing Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -45,22 +45,24 @@ fn prescan_bytestream(bytes: &[u8]) -> Option<encoding::EncodingRef> {
4545 . next ( ) ;
4646
4747 if let Some ( meta) = meta {
48- let charset = meta. value ( ) . attr ( "charset" ) . unwrap ( ) ;
49- return encoding:: label:: encoding_from_whatwg_label ( charset) ;
48+ if let Some ( charset) = meta. value ( ) . attr ( "charset" ) {
49+ return encoding:: label:: encoding_from_whatwg_label ( charset) ;
50+ }
5051 }
5152
5253 let meta = dom
5354 . select ( & scraper:: Selector :: parse ( "meta[http-equiv=content-type]" ) . unwrap ( ) )
5455 . next ( ) ;
5556
5657 if let Some ( meta) = meta {
57- let content = meta. value ( ) . attr ( "content" ) . unwrap ( ) ;
58- let content_type = ContentType :: from ( content) ;
58+ if let Some ( content) = meta. value ( ) . attr ( "content" ) {
59+ let content_type = ContentType :: from ( content) ;
5960
60- return match content_type {
61- Ok ( content_type) => content_type. into ( ) ,
62- Err ( _) => None ,
63- } ;
61+ return match content_type {
62+ Ok ( content_type) => content_type. into ( ) ,
63+ Err ( _) => None ,
64+ } ;
65+ }
6466 }
6567
6668 None
You can’t perform that action at this time.
0 commit comments