mirror of https://github.com/astral-sh/uv
Avoid treating localhost URLs as local file paths (#3132)
## Summary Closes https://github.com/astral-sh/uv/issues/3128. ## Test Plan - `python -m http.server` - `cargo run pip install "http://localhost:8000/werkzeug-3.0.2-py3-none-any.whl"` - `cargo run pip install "http://localhost:8000/werkzeug-3.0.2-py3-none-any.whl"`
This commit is contained in:
parent
0ce039d1f9
commit
3c9d925531
|
|
@ -442,7 +442,10 @@ fn installed_satisfies_requirement(
|
||||||
if let InstalledDist::Url(installed) = &distribution {
|
if let InstalledDist::Url(installed) = &distribution {
|
||||||
if &installed.url == url.raw() {
|
if &installed.url == url.raw() {
|
||||||
// If the requirement came from a local path, check freshness.
|
// If the requirement came from a local path, check freshness.
|
||||||
if let Ok(archive) = url.to_file_path() {
|
if let Some(archive) = (url.scheme() == "file")
|
||||||
|
.then(|| url.to_file_path().ok())
|
||||||
|
.flatten()
|
||||||
|
{
|
||||||
if ArchiveTimestamp::up_to_date_with(
|
if ArchiveTimestamp::up_to_date_with(
|
||||||
&archive,
|
&archive,
|
||||||
ArchiveTarget::Install(distribution),
|
ArchiveTarget::Install(distribution),
|
||||||
|
|
|
||||||
|
|
@ -398,6 +398,7 @@ impl<'a> SitePackages<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the requirement came from a local path, check freshness.
|
// If the requirement came from a local path, check freshness.
|
||||||
|
if url.scheme() == "file" {
|
||||||
if let Ok(archive) = url.to_file_path() {
|
if let Ok(archive) = url.to_file_path() {
|
||||||
if !ArchiveTimestamp::up_to_date_with(
|
if !ArchiveTimestamp::up_to_date_with(
|
||||||
&archive,
|
&archive,
|
||||||
|
|
@ -407,6 +408,7 @@ impl<'a> SitePackages<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Some(pep508_rs::VersionOrUrlRef::VersionSpecifier(version_specifier)) => {
|
Some(pep508_rs::VersionOrUrlRef::VersionSpecifier(version_specifier)) => {
|
||||||
// The installed version doesn't satisfy the requirement.
|
// The installed version doesn't satisfy the requirement.
|
||||||
|
|
@ -441,6 +443,7 @@ impl<'a> SitePackages<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the requirement came from a local path, check freshness.
|
// If the requirement came from a local path, check freshness.
|
||||||
|
if url.scheme() == "file" {
|
||||||
if let Ok(archive) = url.to_file_path() {
|
if let Ok(archive) = url.to_file_path() {
|
||||||
if !ArchiveTimestamp::up_to_date_with(
|
if !ArchiveTimestamp::up_to_date_with(
|
||||||
&archive,
|
&archive,
|
||||||
|
|
@ -450,6 +453,7 @@ impl<'a> SitePackages<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Some(pep508_rs::VersionOrUrl::VersionSpecifier(version_specifier)) => {
|
Some(pep508_rs::VersionOrUrl::VersionSpecifier(version_specifier)) => {
|
||||||
// The installed version doesn't satisfy the requirement.
|
// The installed version doesn't satisfy the requirement.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue