windows: to_file_path() panics for certain URLs created by from_file_path()
Open
Nobody has claimed this yet.
bug
windows
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 406
- PR merge metrics
- No merged PRs in 30d
Description
use std::path::PathBuf;
use url::Url;
fn main() {
let p = PathBuf::from("c:///");
let u = Url::from_file_path(p).unwrap();
println!("url: {:?}", u);
let r = u.to_file_path(); // <-- Panic happens here
println!("result: {:?}", r);
}
output:
url: "file:///C:"
thread 'main' panicked at 'to_file_path() failed to produce an absolute Path', C:\Users\BertBelder\.cargo\registry\src\github.com-1ecc6299db9ec823\url-1.7.2\src\lib.rs:2415:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: process didn't exit successfully: `target\debug\urlt.exe` (exit code: 101)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Windows panic with the Rust example, then inspect src/lib.rs around to_file_path() and its interaction with from_file_path(). Add regression coverage for the shown c:/// URL and verify that converting the generated URL back to a file path no longer panics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100