Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Coverage
on:
push:
branches: ["main"]
pull_request:

jobs:
coverage:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
Test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [1.63.0, 1.82.0, stable, beta, nightly]
os: [windows-latest]
rust: [stable]
exclude:
- os: macos-latest
rust: 1.82.0
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- run: cargo build --all-targets
# Run tests
- name: Run tests
run: cargo test
run: cargo test test_url_parsing
# Run tests enabling the serde feature
- name: Run tests with the serde feature
run: cargo test --features "url/serde,url/expose_internals"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
target
Cargo.lock
/.cargo/config
.DS_Store
20 changes: 15 additions & 5 deletions url/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,31 @@ categories = ["parser-implementations", "web-programming", "encoding", "no-std"]
license = "MIT OR Apache-2.0"
include = ["src/**/*", "LICENSE-*", "README.md", "tests/**"]
edition = "2018"
rust-version = "1.63" # From libc
rust-version = "1.63" # From libc

[dev-dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
bencher = "0.1"
tempfile = { version = "3" }

[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dev-dependencies]
wasm-bindgen-test = "0.3"

[dependencies]
form_urlencoded = { version = "1.2.1", path = "../form_urlencoded", default-features = false, features = ["alloc"] }
idna = { version = "1.0.3", path = "../idna", default-features = false, features = ["alloc", "compiled_data"] }
percent-encoding = { version = "2.3.1", path = "../percent_encoding", default-features = false, features = ["alloc"] }
serde = { version = "1.0", optional = true, features = ["derive"], default-features = false }
form_urlencoded = { version = "1.2.1", path = "../form_urlencoded", default-features = false, features = [
"alloc",
] }
idna = { version = "1.0.3", path = "../idna", default-features = false, features = [
"alloc",
"compiled_data",
] }
percent-encoding = { version = "2.3.1", path = "../percent_encoding", default-features = false, features = [
"alloc",
] }
serde = { version = "1.0", optional = true, features = [
"derive",
], default-features = false }

[features]
default = ["std"]
Expand Down
16 changes: 16 additions & 0 deletions url/tests/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1383,3 +1383,19 @@ fn serde_error_message() {
r#"relative URL without a base: "§invalid#+#*Ä" at line 1 column 25"#
);
}

// https://github.com/servo/rust-url/issues/1077
#[cfg(feature = "std")]
#[test]
fn test_url_parsing() {
let tmpdir = tempfile::tempdir().unwrap();
let tmp_path = tmpdir.path().to_str().unwrap();
let tmp_path = tmp_path.replace("\\", "%5C");
let mut url = url::Url::parse("file://").unwrap();
url.path_segments_mut()
.unwrap()
.pop_if_empty()
.extend(std::iter::once(tmp_path));
dbg!(&url);
url.to_file_path().unwrap();
}
Loading