Skip to content

Commit ae53704

Browse files
committed
..
1 parent 7e2ef57 commit ae53704

File tree

6 files changed

+24
-20
lines changed

6 files changed

+24
-20
lines changed

crates/uv-auth/src/index.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ impl Display for AuthPolicy {
5353
// could potentially make sense for a future refactor.
5454
#[derive(Debug, Clone, Hash, Eq, PartialEq)]
5555
pub struct Index {
56+
pub url: Url,
5657
/// The root endpoint where authentication is applied.
5758
/// For PEP 503 endpoints, this excludes `/simple`.
5859
pub root_url: Url,
@@ -83,8 +84,8 @@ impl Indexes {
8384
// efficient search.
8485
self.0
8586
.iter()
86-
.find(|index| is_url_prefix(&index.root_url, url))
87-
.map(|index| &index.root_url)
87+
.find(|index| is_url_prefix(&index.url, url))
88+
.map(|index| &index.url)
8889
}
8990

9091
/// Get the [`AuthPolicy`] for a URL.

crates/uv-auth/src/middleware.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,10 +1744,12 @@ mod tests {
17441744
let base_url_2 = base_url.join("prefix_2")?;
17451745
let indexes = Indexes::from_indexes(vec![
17461746
Index {
1747+
url: base_url_1.clone(),
17471748
root_url: base_url_1.clone(),
17481749
auth_policy: AuthPolicy::Auto,
17491750
},
17501751
Index {
1752+
url: base_url_2.clone(),
17511753
root_url: base_url_2.clone(),
17521754
auth_policy: AuthPolicy::Auto,
17531755
},
@@ -1850,6 +1852,7 @@ mod tests {
18501852
let base_url = Url::parse(&server.uri())?;
18511853
let index_url = base_url.join("prefix_1")?;
18521854
let indexes = Indexes::from_indexes(vec![Index {
1855+
url: index_url.clone(),
18531856
root_url: index_url.clone(),
18541857
auth_policy: AuthPolicy::Auto,
18551858
}]);
@@ -1908,6 +1911,7 @@ mod tests {
19081911
url.set_password(None).ok();
19091912
url.set_username("").ok();
19101913
Indexes::from_indexes(vec![Index {
1914+
url: url.clone(),
19111915
root_url: url.clone(),
19121916
auth_policy: policy,
19131917
}])

crates/uv-distribution-types/src/index_url.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,14 +413,15 @@ impl<'a> IndexLocations {
413413
impl From<&IndexLocations> for uv_auth::Indexes {
414414
fn from(index_locations: &IndexLocations) -> uv_auth::Indexes {
415415
uv_auth::Indexes::from_indexes(index_locations.allowed_indexes().into_iter().map(|index| {
416-
let mut url = index
417-
.url()
418-
.root()
419-
.unwrap_or_else(|| index.url().url().clone());
416+
let mut url = index.url().url().clone();
420417
url.set_username("").ok();
421418
url.set_password(None).ok();
419+
let mut root_url = index.url().root().unwrap_or_else(|| url.clone());
420+
root_url.set_username("").ok();
421+
root_url.set_password(None).ok();
422422
uv_auth::Index {
423-
root_url: url,
423+
url,
424+
root_url,
424425
auth_policy: index.authenticate,
425426
}
426427
}))

crates/uv/tests/it/edit.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10246,14 +10246,14 @@ fn add_index_url_in_keyring() -> Result<()> {
1024610246

1024710247
uv_snapshot!(context.add().arg("anyio")
1024810248
.env(EnvVars::index_username("PROXY"), "public")
10249-
.env(EnvVars::KEYRING_TEST_CREDENTIALS, r#"{"https://pypi-proxy.fly.dev/basic-auth": {"public": "heron"}}"#)
10249+
.env(EnvVars::KEYRING_TEST_CREDENTIALS, r#"{"https://pypi-proxy.fly.dev/basic-auth/simple": {"public": "heron"}}"#)
1025010250
.env(EnvVars::PATH, venv_bin_path(&keyring_context.venv)), @r"
1025110251
success: true
1025210252
exit_code: 0
1025310253
----- stdout -----
1025410254
1025510255
----- stderr -----
10256-
Keyring request for public@https://pypi-proxy.fly.dev/basic-auth
10256+
Keyring request for public@https://pypi-proxy.fly.dev/basic-auth/simple
1025710257
Resolved 4 packages in [TIME]
1025810258
Prepared 3 packages in [TIME]
1025910259
Installed 3 packages in [TIME]
@@ -10307,14 +10307,14 @@ fn add_full_url_in_keyring() -> Result<()> {
1030710307

1030810308
uv_snapshot!(context.add().arg("anyio")
1030910309
.env(EnvVars::index_username("PROXY"), "public")
10310-
.env(EnvVars::KEYRING_TEST_CREDENTIALS, r#"{"https://pypi-proxy.fly.dev/basic-auth/simple/anyio/": {"public": "heron"}}"#)
10310+
.env(EnvVars::KEYRING_TEST_CREDENTIALS, r#"{"https://pypi-proxy.fly.dev/basic-auth/simple/anyio": {"public": "heron"}}"#)
1031110311
.env(EnvVars::PATH, venv_bin_path(&keyring_context.venv)), @r"
1031210312
success: false
1031310313
exit_code: 1
1031410314
----- stdout -----
1031510315
1031610316
----- stderr -----
10317-
Keyring request for public@https://pypi-proxy.fly.dev/basic-auth
10317+
Keyring request for public@https://pypi-proxy.fly.dev/basic-auth/simple
1031810318
Keyring request for [email protected]
1031910319
× No solution found when resolving dependencies:
1032010320
╰─▶ Because anyio was not found in the package registry and your project depends on anyio, we can conclude that your project's requirements are unsatisfiable.
@@ -10323,8 +10323,6 @@ fn add_full_url_in_keyring() -> Result<()> {
1032310323
help: If you want to add the package regardless of the failed resolution, provide the `--frozen` flag to skip locking and syncing.
1032410324
"
1032510325
);
10326-
10327-
context.assert_command("import anyio").success();
1032810326
Ok(())
1032910327
}
1033010328

crates/uv/tests/it/lock.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18808,7 +18808,7 @@ fn lock_keyring_credentials() -> Result<()> {
1880818808
----- stdout -----
1880918809

1881018810
----- stderr -----
18811-
Keyring request for public@https://pypi-proxy.fly.dev/basic-auth
18811+
Keyring request for public@https://pypi-proxy.fly.dev/basic-auth/simple
1881218812
Keyring request for [email protected]
1881318813
Resolved 2 packages in [TIME]
1881418814
");
@@ -18913,7 +18913,7 @@ fn lock_keyring_explicit_always() -> Result<()> {
1891318913
----- stdout -----
1891418914

1891518915
----- stderr -----
18916-
Keyring request for https://pypi-proxy.fly.dev/basic-auth
18916+
Keyring request for https://pypi-proxy.fly.dev/basic-auth/simple
1891718917
Keyring request for pypi-proxy.fly.dev
1891818918
× No solution found when resolving dependencies:
1891918919
╰─▶ Because iniconfig was not found in the package registry and your project depends on iniconfig, we can conclude that your project's requirements are unsatisfiable.
@@ -18930,7 +18930,7 @@ fn lock_keyring_explicit_always() -> Result<()> {
1893018930
----- stdout -----
1893118931

1893218932
----- stderr -----
18933-
Keyring request for https://pypi-proxy.fly.dev/basic-auth
18933+
Keyring request for https://pypi-proxy.fly.dev/basic-auth/simple
1893418934
Keyring request for pypi-proxy.fly.dev
1893518935
Resolved 2 packages in [TIME]
1893618936
");
@@ -18996,7 +18996,7 @@ fn lock_keyring_credentials_always_authenticate_fetches_username() -> Result<()>
1899618996
----- stdout -----
1899718997

1899818998
----- stderr -----
18999-
Keyring request for https://pypi-proxy.fly.dev/basic-auth
18999+
Keyring request for https://pypi-proxy.fly.dev/basic-auth/simple
1900019000
Keyring request for pypi-proxy.fly.dev
1900119001
Resolved 2 packages in [TIME]
1900219002
");

crates/uv/tests/it/pip_install.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5341,7 +5341,7 @@ fn install_package_basic_auth_from_keyring() {
53415341
----- stdout -----
53425342
53435343
----- stderr -----
5344-
Keyring request for public@https://pypi-proxy.fly.dev/basic-auth
5344+
Keyring request for public@https://pypi-proxy.fly.dev/basic-auth/simple
53455345
Keyring request for [email protected]
53465346
Resolved 3 packages in [TIME]
53475347
Prepared 3 packages in [TIME]
@@ -5388,7 +5388,7 @@ fn install_package_basic_auth_from_keyring_wrong_password() {
53885388
----- stdout -----
53895389
53905390
----- stderr -----
5391-
Keyring request for public@https://pypi-proxy.fly.dev/basic-auth
5391+
Keyring request for public@https://pypi-proxy.fly.dev/basic-auth/simple
53925392
Keyring request for [email protected]
53935393
× No solution found when resolving dependencies:
53945394
╰─▶ Because anyio was not found in the package registry and you require anyio, we can conclude that your requirements are unsatisfiable.
@@ -5431,7 +5431,7 @@ fn install_package_basic_auth_from_keyring_wrong_username() {
54315431
----- stdout -----
54325432
54335433
----- stderr -----
5434-
Keyring request for public@https://pypi-proxy.fly.dev/basic-auth
5434+
Keyring request for public@https://pypi-proxy.fly.dev/basic-auth/simple
54355435
Keyring request for [email protected]
54365436
× No solution found when resolving dependencies:
54375437
╰─▶ Because anyio was not found in the package registry and you require anyio, we can conclude that your requirements are unsatisfiable.

0 commit comments

Comments
 (0)