From 75771772ec76b910faa1021050e68e37136cf6b4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 23 Jul 2024 18:21:01 -0400 Subject: [PATCH] remove uuid from url when calling git credential The user doesn't want to see a uuid in the prompt. Also, when a http server is proxying, multiple remotes will have the same base url, and the same password will work for them all. --- P2P/Http/Client.hs | 5 +++-- P2P/Http/Url.hs | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/P2P/Http/Client.hs b/P2P/Http/Client.hs index 4b5ea987ed..1d299c9cc8 100644 --- a/P2P/Http/Client.hs +++ b/P2P/Http/Client.hs @@ -24,7 +24,6 @@ import P2P.Http.Url import Annex.Common import P2P.Protocol hiding (Offset, Bypass, auth) import Annex.Concurrent -import Messages import Utility.Url (BasicAuth(..)) import qualified Git.Credential as Git @@ -100,7 +99,9 @@ p2pHttpClient rmt fallback clientaction = case p2pHttpUrlString <$> remoteAnnexP2PHttpUrl (gitconfig rmt) of Nothing -> error "internal" Just url -> do - cred <- prompt (inRepo $ Git.getUrlCredential url) + cred <- prompt $ + inRepo $ Git.getUrlCredential $ + p2pHttpUrlWithoutUUID url let mauth = do ba <- Git.credentialBasicAuth cred return $ Auth diff --git a/P2P/Http/Url.hs b/P2P/Http/Url.hs index e087edd9b3..92439623fb 100644 --- a/P2P/Http/Url.hs +++ b/P2P/Http/Url.hs @@ -88,3 +88,6 @@ parseP2PHttpUrl us , baseUrlPort = port } #endif + +p2pHttpUrlWithoutUUID :: String -> String +p2pHttpUrlWithoutUUID = reverse . dropWhile (/= '/') . reverse -- 2.30.2