Skip to content

Panic for file while using base #1114

@wooffie

Description

@wooffie
  • Note that this crate implements the URL Standard not RFC 1738 or RFC 3986

Describe the bug

Testcase:

#[test]
fn test_file_base_panic() {
    let base_url = Url::parse("file:///w:/a:").unwrap();
    Url::options().base_url(Some(&base_url)).parse("file:..");
}

Backtrace:

thread 'test_file_base_panic' (377458) panicked at url/src/parser.rs:1321:21:
assertion failed: self.serialization.as_bytes()[segment_start - 1] == b'/'
stack backtrace:
< skipped >
  19:     0x57a3a138611c - core::panicking::panic::hb515f22c0e98143a
                               at /rustc/f8297e351a40c1439a467bbbb6879088047f50b3/library/core/src/panicking.rs:145:5
  20:     0x57a3a12cfb59 - url::parser::Parser::parse_path::h69b46743c9367ec2
                               at /home/wooffie/work/upstream/rust-url/url/src/parser.rs:1321:21
  21:     0x57a3a12cd0d9 - url::parser::Parser::parse_file::h88e81c17dec524c5
                               at /home/wooffie/work/upstream/rust-url/url/src/parser.rs:659:46
  22:     0x57a3a12d3896 - url::parser::Parser::parse_with_scheme::h31ca21d8147c599c
                               at /home/wooffie/work/upstream/rust-url/url/src/parser.rs:446:22
  23:     0x57a3a12d637d - url::parser::Parser::parse_url::hadfb176b92197e15
                               at /home/wooffie/work/upstream/rust-url/url/src/parser.rs:382:25
  24:     0x57a3a12af420 - url::ParseOptions::parse::hf1b29cfaa662d5f3
                               at /home/wooffie/work/upstream/rust-url/url/src/lib.rs:314:10
  25:     0x57a3a124735b - unit::test_file_base_panic::h46e4b9e042615051
                               at /home/wooffie/work/upstream/rust-url/url/tests/unit.rs:725:46

ref #838

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