From b072b71c274324400aba3433d8248e84af24b879 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 16 Jun 2020 18:28:26 -0400 Subject: [PATCH] one more bugfix to external special remote creds The creds are passedthrough in this case, so check for such first to avoid a crash when getRemoteConfigValue sees a type it was not expecting. --- Creds.hs | 7 ++++++- doc/bugs/embedcreds_with_external_special_remotes.mdwn | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Creds.hs b/Creds.hs index f86115a0ff..df87c5af77 100644 --- a/Creds.hs +++ b/Creds.hs @@ -113,7 +113,12 @@ getRemoteCredPair c gc storage = maybe fromcache (return . Just) =<< fromenv fromconfig = do let key = credPairRemoteField storage mcipher <- remoteCipher' c gc - case (getRemoteConfigValue key c, mcipher) of + -- The RemoteConfig value may be passed through. + -- Check for those first, because getRemoteConfigValue + -- will throw an error if it does not find it. + let getval = M.lookup key (getRemoteConfigPassedThrough c) + <|> getRemoteConfigValue key c + case (getval, mcipher) of (Nothing, _) -> return Nothing (Just enccreds, Just (cipher, storablecipher)) -> fromenccreds enccreds cipher storablecipher diff --git a/doc/bugs/embedcreds_with_external_special_remotes.mdwn b/doc/bugs/embedcreds_with_external_special_remotes.mdwn index d30de4e3a2..396b7ee366 100644 --- a/doc/bugs/embedcreds_with_external_special_remotes.mdwn +++ b/doc/bugs/embedcreds_with_external_special_remotes.mdwn @@ -66,3 +66,5 @@ I can see that gpg is called after SETCREDS and I would have expected there to b ### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders) Of course ;) In fact. I've actually never used embedcreds. I just had an [issue](https://github.com/Lykos153/git-annex-remote-googledrive/issues/48) raised about it on github. + +> [[fixed|done]] --[[Joey]]