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 @@ -469,12 +469,12 @@ fn token_native_auth_realm() -> Result<()> {
469469 . arg( "--username" )
470470 . arg( "public" )
471471 . env( EnvVars :: UV_PREVIEW_FEATURES , "native-auth" ) , @r"
472- success: false
473- exit_code: 2
472+ success: true
473+ exit_code: 0
474474 ----- stdout -----
475+ heron
475476
476477 ----- stderr -----
477- error: Failed to fetch credentials for public@https://pypi-proxy.fly.dev/basic-auth/simple
478478 " ) ;
479479
480480 // Without the username
@@ -568,12 +568,12 @@ fn token_native_auth_realm() -> Result<()> {
568568 uv_snapshot ! ( context. auth_token( )
569569 . arg( "https://public@pypi-proxy.fly.dev/basic-auth/simple" )
570570 . env( EnvVars :: UV_PREVIEW_FEATURES , "native-auth" ) , @r"
571- success: false
572- exit_code: 2
571+ success: true
572+ exit_code: 0
573573 ----- stdout -----
574+ heron
574575
575576 ----- stderr -----
576- error: Failed to fetch credentials for public@https://pypi-proxy.fly.dev/basic-auth/simple
577577 " ) ;
578578
579579 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments