@@ -523,12 +523,13 @@ impl<'a> Parser<'a> {
523523 self . serialization . push_str ( "file:///" ) ;
524524 let scheme_end = "file" . len ( ) as u32 ;
525525 let path_start = "file://" . len ( ) ;
526- if let Some ( base_url) = base_file_url {
527- let first_segment = base_url. path_segments ( ) . unwrap ( ) . next ( ) . unwrap ( ) ;
528- // FIXME: *normalized* drive letter
529- if is_windows_drive_letter ( first_segment) {
530- self . serialization . push_str ( first_segment) ;
531- self . serialization . push ( '/' ) ;
526+ if !starts_with_windows_drive_letter_segment ( & input_after_first_char) {
527+ if let Some ( base_url) = base_file_url {
528+ let first_segment = base_url. path_segments ( ) . unwrap ( ) . next ( ) . unwrap ( ) ;
529+ if is_normalized_windows_drive_letter ( first_segment) {
530+ self . serialization . push_str ( first_segment) ;
531+ self . serialization . push ( '/' ) ;
532+ }
532533 }
533534 }
534535 let remaining = self . parse_path (
@@ -1343,6 +1344,10 @@ pub fn to_u32(i: usize) -> ParseResult<u32> {
13431344 }
13441345}
13451346
1347+ fn is_normalized_windows_drive_letter ( segment : & str ) -> bool {
1348+ is_windows_drive_letter ( segment) && segment. as_bytes ( ) [ 1 ] == b':'
1349+ }
1350+
13461351/// Wether the scheme is file:, the path has a single segment, and that segment
13471352/// is a Windows drive letter
13481353fn is_windows_drive_letter ( segment : & str ) -> bool {
0 commit comments