@@ -541,12 +541,13 @@ impl<'a> Parser<'a> {
541
541
self . serialization . push_str ( "file:///" ) ;
542
542
let scheme_end = "file" . len ( ) as u32 ;
543
543
let path_start = "file://" . len ( ) ;
544
- if let Some ( base_url) = base_file_url {
545
- let first_segment = base_url. path_segments ( ) . unwrap ( ) . next ( ) . unwrap ( ) ;
546
- // FIXME: *normalized* drive letter
547
- if is_windows_drive_letter ( first_segment) {
548
- self . serialization . push_str ( first_segment) ;
549
- self . serialization . push ( '/' ) ;
544
+ if !starts_with_windows_drive_letter_segment ( & input_after_first_char) {
545
+ if let Some ( base_url) = base_file_url {
546
+ let first_segment = base_url. path_segments ( ) . unwrap ( ) . next ( ) . unwrap ( ) ;
547
+ if is_normalized_windows_drive_letter ( first_segment) {
548
+ self . serialization . push_str ( first_segment) ;
549
+ self . serialization . push ( '/' ) ;
550
+ }
550
551
}
551
552
}
552
553
let remaining = self . parse_path (
@@ -1361,6 +1362,10 @@ pub fn to_u32(i: usize) -> ParseResult<u32> {
1361
1362
}
1362
1363
}
1363
1364
1365
+ fn is_normalized_windows_drive_letter ( segment : & str ) -> bool {
1366
+ is_windows_drive_letter ( segment) && segment. as_bytes ( ) [ 1 ] == b':'
1367
+ }
1368
+
1364
1369
/// Wether the scheme is file:, the path has a single segment, and that segment
1365
1370
/// is a Windows drive letter
1366
1371
fn is_windows_drive_letter ( segment : & str ) -> bool {
0 commit comments