File tree Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Expand file tree Collapse file tree 2 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -87,9 +87,26 @@ impl KeyringProvider {
8787 // Ensure we strip credentials from the URL before storing
8888 let url = url. without_credentials ( ) ;
8989
90+ // If there's no path, we'll perform a host-level login
91+ let target = if let Some ( host) = url. host_str ( ) . filter ( |_| !url. path ( ) . is_empty ( ) ) {
92+ let mut target = String :: new ( ) ;
93+ if url. scheme ( ) != "https" {
94+ target. push_str ( url. scheme ( ) ) ;
95+ target. push_str ( "://" ) ;
96+ }
97+ target. push_str ( host) ;
98+ if let Some ( port) = url. port ( ) {
99+ target. push ( ':' ) ;
100+ target. push_str ( & port. to_string ( ) ) ;
101+ }
102+ target
103+ } else {
104+ url. to_string ( )
105+ } ;
106+
90107 match & self . backend {
91108 KeyringProviderBackend :: Native => {
92- self . store_native ( url . as_str ( ) , username, password) . await ?;
109+ self . store_native ( & target , username, password) . await ?;
93110 Ok ( true )
94111 }
95112 KeyringProviderBackend :: Subprocess => {
Original file line number Diff line number Diff line change @@ -462,12 +462,12 @@ fn token_native_auth_realm() -> Result<()> {
462462 . arg( "--username" )
463463 . arg( "public" )
464464 . env( EnvVars :: UV_PREVIEW_FEATURES , "native-auth" ) , @r"
465- success: false
466- exit_code: 2
465+ success: true
466+ exit_code: 0
467467 ----- stdout -----
468+ heron
468469
469470 ----- stderr -----
470- error: Failed to fetch credentials for public@https://pypi-proxy.fly.dev/basic-auth/simple
471471 " ) ;
472472
473473 // Without the username
@@ -561,12 +561,12 @@ fn token_native_auth_realm() -> Result<()> {
561561 uv_snapshot ! ( context. auth_token( )
562562 . arg( "https://public@pypi-proxy.fly.dev/basic-auth/simple" )
563563 . env( EnvVars :: UV_PREVIEW_FEATURES , "native-auth" ) , @r"
564- success: false
565- exit_code: 2
564+ success: true
565+ exit_code: 0
566566 ----- stdout -----
567+ heron
567568
568569 ----- stderr -----
569- error: Failed to fetch credentials for public@https://pypi-proxy.fly.dev/basic-auth/simple
570570 " ) ;
571571
572572 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments