Skip to content

Commit 2529065

Browse files
committed
Fix hostname preservation in file: URLs that contain drive letters
Fixes #1126
1 parent 55ff72d commit 2529065

2 files changed

Lines changed: 0 additions & 11 deletions

File tree

url/src/parser.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -541,14 +541,6 @@ impl Parser<'_> {
541541
self.parse_path(SchemeType::File, &mut has_host, path_start, remaining)
542542
};
543543

544-
// For file URLs that have a host and whose path starts
545-
// with the windows drive letter we just remove the host.
546-
if !has_host {
547-
self.serialization
548-
.drain(host_start as usize..host_end as usize);
549-
host_end = host_start;
550-
host = HostInternal::None;
551-
}
552544
let (query_start, fragment_start) =
553545
self.parse_query_and_fragment(scheme_type, scheme_end, remaining)?;
554546
return Ok(Url {

url/tests/expected_failures.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
<C|\n/> against <file://host/dir/file>
2020
<C|\\> against <file://host/dir/file>
2121
</c:/foo/bar> against <file://host/path>
22-
<file://example.net/C:/>
23-
<file://1.2.3.4/C:/>
24-
<file://[1::8]/C:/>
2522
<C|/> against <file://host/>
2623
</C:/> against <file://host/>
2724
<file:C:/> against <file://host/>

0 commit comments

Comments
 (0)