Closed Bug 1874119 Opened 10 months ago Closed 23 days ago

Setting <non-spec:/>.pathname = '/.//p'

Categories

(Core :: Networking, defect, P3)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: valentin, Assigned: sekim)

References

(Blocks 2 open bugs, )

Details

(Whiteboard: [necko-triaged][necko-priority-queue])

Whiteboard: [necko-triaged]

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"
Assignee: nobody → sekim

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

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?

Flags: needinfo?(edgul)

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.

Flags: needinfo?(edgul)

.

(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

Status: NEW → ASSIGNED
Whiteboard: [necko-triaged] → [necko-triaged][necko-priority-next]
Whiteboard: [necko-triaged][necko-priority-next] → [necko-triaged][necko-priority-queue]
Status: ASSIGNED → RESOLVED
Closed: 23 days ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.