Skip to content

Commit e3e0b34

Browse files
author
bors-servo
authored
Auto merge of #412 - valenting:fix-file-bug, r=SimonSapin
Fix file:#frag test case This test case used to be parsed as file:///frag\ and it would assert in check_invariants Fixes #398 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-url/412) <!-- Reviewable:end -->
2 parents 211bf4a + a706400 commit e3e0b34

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/parser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ impl<'a> Parser<'a> {
451451
let scheme_end = "file".len() as u32;
452452
let path_start = "file://".len() as u32;
453453
let fragment_start = "file:///".len() as u32;
454+
self.serialization.push('#');
454455
self.parse_fragment(input_after_first_char);
455456
Ok(Url {
456457
serialization: self.serialization,

tests/urltestdata.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5414,6 +5414,20 @@
54145414
"search": "?q=v",
54155415
"hash": ""
54165416
},
5417+
{
5418+
"input": "file:#frag",
5419+
"base": "about:blank",
5420+
"href": "file:///#frag",
5421+
"protocol": "file:",
5422+
"username": "",
5423+
"password": "",
5424+
"host": "",
5425+
"hostname": "",
5426+
"port": "",
5427+
"pathname": "/",
5428+
"search": "",
5429+
"hash": "#frag"
5430+
},
54175431
"# IPv6 tests",
54185432
{
54195433
"input": "http://[1:0::]",

0 commit comments

Comments
 (0)