mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-01 20:31:12 +00:00
Avoid stripping query parameters from URLs (#10253)
## Summary Closes https://github.com/astral-sh/uv/issues/10251.
This commit is contained in:
parent
c77aa5820b
commit
cf88828e55
2 changed files with 14 additions and 9 deletions
|
|
@ -3862,15 +3862,14 @@ impl<'de> serde::Deserialize<'de> for Hash {
|
|||
/// Convert a [`FileLocation`] into a normalized [`UrlString`].
|
||||
fn normalize_file_location(location: &FileLocation) -> Result<UrlString, ToUrlError> {
|
||||
match location {
|
||||
FileLocation::AbsoluteUrl(ref absolute) => Ok(absolute.as_base_url()),
|
||||
FileLocation::AbsoluteUrl(ref absolute) => Ok(absolute.without_fragment()),
|
||||
FileLocation::RelativeUrl(_, _) => Ok(normalize_url(location.to_url()?)),
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert a [`Url`] into a normalized [`UrlString`].
|
||||
/// Convert a [`Url`] into a normalized [`UrlString`] by removing the fragment.
|
||||
fn normalize_url(mut url: Url) -> UrlString {
|
||||
url.set_fragment(None);
|
||||
url.set_query(None);
|
||||
UrlString::from(url)
|
||||
}
|
||||
|
||||
|
|
@ -3995,9 +3994,8 @@ fn normalize_requirement(requirement: Requirement, root: &Path) -> Result<Requir
|
|||
// Redact the credentials.
|
||||
redact_credentials(&mut location);
|
||||
|
||||
// Remove the fragment and query from the URL; they're already present in the source.
|
||||
// Remove the fragment from the URL; it's already present in the source.
|
||||
location.set_fragment(None);
|
||||
location.set_query(None);
|
||||
|
||||
// Reconstruct the PEP 508 URL from the underlying data.
|
||||
let url = Url::from(ParsedArchiveUrl {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue