@@ -523,12 +523,13 @@ impl<'a> Parser<'a> {
523
523
self . serialization . push_str ( "file:///" ) ;
524
524
let scheme_end = "file" . len ( ) as u32 ;
525
525
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
+ }
532
533
}
533
534
}
534
535
let remaining = self . parse_path (
@@ -1343,6 +1344,10 @@ pub fn to_u32(i: usize) -> ParseResult<u32> {
1343
1344
}
1344
1345
}
1345
1346
1347
+ fn is_normalized_windows_drive_letter ( segment : & str ) -> bool {
1348
+ is_windows_drive_letter ( segment) && segment. as_bytes ( ) [ 1 ] == b':'
1349
+ }
1350
+
1346
1351
/// Wether the scheme is file:, the path has a single segment, and that segment
1347
1352
/// is a Windows drive letter
1348
1353
fn is_windows_drive_letter ( segment : & str ) -> bool {
0 commit comments