Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic in set_path #864

Open
Timmmm opened this issue Aug 27, 2023 · 1 comment
Open

Panic in set_path #864

Timmmm opened this issue Aug 27, 2023 · 1 comment

Comments

@Timmmm
Copy link

Timmmm commented Aug 27, 2023

fn main() {
    let mut url = url::Url::parse("file:///d:/test").unwrap();
    url.set_path("d:\\test\\main.foo");
    dbg!(url);
}

Output:

thread 'main' panicked at 'byte index 8 is out of bounds of `file://`', /playground/.cargo/registry/src/index.crates.io-6f17d22bba15001f/url-2.4.0/src/parser.rs:1207:34

Playground.

@Timmmm
Copy link
Author

Timmmm commented Aug 27, 2023

Slightly more minimised:

fn main() {
    let mut url = url::Url::parse("file://").unwrap();
    dbg!(&url);
    url.set_path("x");
    dbg!(&url);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant