mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Discard fragments when parsing unnamed URLs (#3940)
## Summary Closes https://github.com/astral-sh/uv/issues/3934.
This commit is contained in:
parent
72b1642232
commit
8c11f99fdf
5 changed files with 67 additions and 6 deletions
|
@ -155,6 +155,13 @@ impl VerbatimUrl {
|
|||
pub fn to_url(&self) -> Url {
|
||||
self.url.clone()
|
||||
}
|
||||
|
||||
/// Return the underlying [`Path`], if the URL is a file URL.
|
||||
pub fn as_path(&self) -> Result<PathBuf, VerbatimUrlError> {
|
||||
self.url
|
||||
.to_file_path()
|
||||
.map_err(|_| VerbatimUrlError::UrlConversion(self.url.to_file_path().unwrap()))
|
||||
}
|
||||
}
|
||||
|
||||
// This impl is written out because the `derive` doesn't seem to get it right.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue