diff options
author | Joey Hess <joey@kitenet.net> | 2013-04-27 15:16:06 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-04-27 15:16:06 -0400 |
commit | c83faab80214096645edbc6b7b6d3a9f3a7394b1 (patch) | |
tree | 7c1bf39d5c645f35ebb6705078f65c20689d466e /Remote | |
parent | 7193a999b82bef820dfdbc6ebbf06474f3066b81 (diff) |
webapp: Now automatically fills in any creds used by an existing remote when creating a new remote of the same type. Done for Internet Archive, S3, Glacier, and Box.com remotes.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/WebDAV.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Remote/WebDAV.hs b/Remote/WebDAV.hs index 0f94a2f08..8af4791c0 100644 --- a/Remote/WebDAV.hs +++ b/Remote/WebDAV.hs @@ -7,7 +7,7 @@ {-# LANGUAGE ScopedTypeVariables, CPP #-} -module Remote.WebDAV (remote, davCreds, setCredsEnv) where +module Remote.WebDAV (remote, davCreds, setCredsEnv, configUrl) where import Network.Protocol.HTTP.DAV import qualified Data.Map as M @@ -203,11 +203,14 @@ withStoredFiles r k baseurl user pass onerr a davAction :: Remote -> a -> ((DavUrl, DavUser, DavPass) -> Annex a) -> Annex a davAction r unconfigured action = do mcreds <- getCreds (config r) (uuid r) - case (mcreds, M.lookup "url" $ config r) of + case (mcreds, configUrl r) of (Just (user, pass), Just url) -> action (url, toDavUser user, toDavPass pass) _ -> return unconfigured +configUrl :: Remote -> Maybe DavUrl +configUrl r = M.lookup "url" $ config r + toDavUser :: String -> DavUser toDavUser = B8.fromString |