mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Use canonical URL to key redirect map (#2764)
## Summary This fixes a potential bug that revealed itself in https://github.com/astral-sh/uv/pull/2761. We don't run into this now because we always use "allowed URLs", stores the "last" compatible URL in the map. But the use of the "raw" URL (rather than the "canonical" URL) means that other writers have to follow that same assumption and iterate over dependencies in-order.
This commit is contained in:
parent
d2bbc07b76
commit
999d653404
3 changed files with 16 additions and 7 deletions
|
@ -6,6 +6,7 @@ use std::ops::Deref;
|
|||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Result;
|
||||
use cache_key::CanonicalUrl;
|
||||
use dashmap::{DashMap, DashSet};
|
||||
use futures::{FutureExt, StreamExt};
|
||||
use itertools::Itertools;
|
||||
|
@ -949,13 +950,19 @@ impl<
|
|||
if let Some(precise) = precise {
|
||||
match distribution {
|
||||
SourceDist::DirectUrl(sdist) => {
|
||||
self.index.redirects.insert(sdist.url.to_url(), precise);
|
||||
self.index
|
||||
.redirects
|
||||
.insert(CanonicalUrl::new(&sdist.url), precise);
|
||||
}
|
||||
SourceDist::Git(sdist) => {
|
||||
self.index.redirects.insert(sdist.url.to_url(), precise);
|
||||
self.index
|
||||
.redirects
|
||||
.insert(CanonicalUrl::new(&sdist.url), precise);
|
||||
}
|
||||
SourceDist::Path(sdist) => {
|
||||
self.index.redirects.insert(sdist.url.to_url(), precise);
|
||||
self.index
|
||||
.redirects
|
||||
.insert(CanonicalUrl::new(&sdist.url), precise);
|
||||
}
|
||||
SourceDist::Registry(_) => {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue