File tree 2 files changed +11
-6
lines changed 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -1038,25 +1038,24 @@ impl<'a> Parser<'a> {
1038
1038
& mut self ,
1039
1039
input : Input < ' i > ,
1040
1040
) -> ParseResult < ( bool , HostInternal , Input < ' i > ) > {
1041
- let has_host;
1042
- let ( _, host_str, remaining) = Parser :: file_host ( input) ?;
1041
+ let ( has_host, host_str, remaining) = Parser :: file_host ( input) ?;
1042
+ if !has_host {
1043
+ return Ok ( ( false , HostInternal :: None , remaining) ) ;
1044
+ }
1043
1045
let host = if host_str. is_empty ( ) {
1044
- has_host = false ;
1045
1046
HostInternal :: None
1046
1047
} else {
1047
1048
match Host :: parse ( & host_str) ? {
1048
1049
Host :: Domain ( ref d) if d == "localhost" => {
1049
- has_host = false ;
1050
1050
HostInternal :: None
1051
1051
}
1052
1052
host => {
1053
1053
write ! ( & mut self . serialization, "{}" , host) . unwrap ( ) ;
1054
- has_host = true ;
1055
1054
host. into ( )
1056
1055
}
1057
1056
}
1058
1057
} ;
1059
- Ok ( ( has_host , host, remaining) )
1058
+ Ok ( ( true , host, remaining) )
1060
1059
}
1061
1060
1062
1061
pub fn file_host ( input : Input ) -> ParseResult < ( bool , String , Input ) > {
Original file line number Diff line number Diff line change @@ -1306,3 +1306,9 @@ fn issue_864() {
1306
1306
url. set_path ( "x" ) ;
1307
1307
dbg ! ( & url) ;
1308
1308
}
1309
+
1310
+ #[ test]
1311
+ fn issue_889 ( ) {
1312
+ let u = Url :: parse ( "file:///C|/hello/world" ) . unwrap ( ) ;
1313
+ assert_eq ! ( u. as_str( ) , "file:///C:/hello/world" ) ;
1314
+ }
You can’t perform that action at this time.
0 commit comments