Setting <non-spec:/>.pathname = '/.//p'
Categories
(Core :: Networking, defect, P3)
Tracking
()
People
(Reporter: valentin, Unassigned)
References
(Blocks 1 open bug, )
Details
(Whiteboard: [necko-triaged][necko-priority-next][patch-available])
This bug comes from rust-url not being able to handle this case.
Reporter | ||
Updated•2 years ago
|
STR:
let url = new URL("non-spec:/");
url.pathname = "/.//p"
url
Results in:
URL { href: "non-spec://p", ... , pathname: "//p", ... }
Expected (rust-url):
"href": "non-spec:/.//p",
"pathname": "//p"
Updated•1 year ago
|
Comment 2•1 year ago
|
||
Comment 3•1 year ago
|
||
Seems like the issue is due to https://github.com/servo/rust-url/blob/f447500049cbfe42203ff16026842e74f3fd99ac/url/src/parser.rs#L1384-1385, this is unable to recognize cases where "//"
occurs across serialization
and pathname
Comment 4•1 year ago
|
||
fn test_nonspec() {
let u1 = url::Url::parse("non-spec:/").unwrap();
let url = Url::join(&u1, "/.//p").unwrap();
println!("{}", url);
...
}
>> non-spec:/.//p
The current test that I implemented is incorrect; is there a way to assign url.pathname
for experimentation?
Did you try adding a test to the setters_tests.json?
It looks like that file gets pulled in here and sets the pathname here.
Comment 6•1 year ago
•
|
||
.
Comment 7•1 year ago
|
||
(In reply to Ed Guloien [:edgul] from comment #5)
Did you try adding a test to the setters_tests.json?
It looks like that file gets pulled in here and sets the pathname here.
The test already seems to exist, I just can't seem to log the issues via cargo test
or any of its variants.
Ah, by "log" I'm assuming you mean print to std::out. (Please correct me if I'm wrong)
I believe you are looking for cargo test -- --nocapture
Updated•1 year ago
|
Updated•11 months ago
|
Updated•11 months ago
|
Updated•10 months ago
|
Comment 9•10 months ago
|
||
Updated•8 months ago
|
Comment 10•8 months ago
•
|
||
Tracking regression on rust-url:
The issue was reproducible with:
#[test]
fn testing() {
let mut url = Url::parse("data:/.0.1").unwrap();
assert!(!url.cannot_be_a_base());
url.set_path(".0.1");
assert_eq!(url.as_str(), "data:/.0.1");
}
assertion `left == right` failed
left: "dat/.0.1"
right: "data:/.0.1"
Updated•5 months ago
|
Updated•4 months ago
|
Comment 11•4 months ago
|
||
Patch is available on GitHub.
Description
•