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.
This commit is contained in:
Joey Hess 2020-06-16 18:28:26 -04:00
parent 5c0dc7dc0b
commit b072b71c27
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 8 additions and 1 deletions

View file

@ -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