Skip to content

Leading slashes are dropped while setting pathname for file urls #1118

Description

@kt3k
use url::Url;

fn main() {
    let mut u = Url::parse("file:///").unwrap();
    u.set_path("//foo");
    println!("{}", u);
}

This should prints file:////foo instead of file:///foo.

Note: The below prints file:////foo in all major browsers

const a = new URL("file:///");
a.pathname = "//foo";
console.log(a.href);

This behavior affects the WPT cases below:

<file://monkey/> set pathname to <\\\\>
<file:///unicorn> set pathname to <//\\/>
<file:///unicorn> set pathname to <//monkey/..//>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions