diff --git a/Assistant/WebApp/Configurators/AWS.hs b/Assistant/WebApp/Configurators/AWS.hs index 76055b75ac..fa0c23bea1 100644 --- a/Assistant/WebApp/Configurators/AWS.hs +++ b/Assistant/WebApp/Configurators/AWS.hs @@ -162,7 +162,7 @@ getEnableS3R :: UUID -> Handler Html #ifdef WITH_S3 getEnableS3R uuid = do m <- liftAnnex readRemoteLog - if isIARemoteConfig $ fromJust $ M.lookup uuid m + if maybe False S3.isIA (M.lookup uuid m) then redirect $ EnableIAR uuid else postEnableS3R uuid #else @@ -220,12 +220,9 @@ getRepoInfo c = [whamlet|S3 remote using bucket: #{bucket}|] bucket = fromMaybe "" $ M.lookup "bucket" c #ifdef WITH_S3 -isIARemoteConfig :: RemoteConfig -> Bool -isIARemoteConfig = S3.isIAHost . fromMaybe "" . M.lookup "host" - previouslyUsedAWSCreds :: Annex (Maybe CredPair) previouslyUsedAWSCreds = getM gettype [S3.remote, Glacier.remote] where gettype t = previouslyUsedCredPair AWS.creds t $ - not . isIARemoteConfig . Remote.config + not . S3.isIA . Remote.config #endif diff --git a/Assistant/WebApp/Configurators/IA.hs b/Assistant/WebApp/Configurators/IA.hs index 055c1743c6..ad18003cc1 100644 --- a/Assistant/WebApp/Configurators/IA.hs +++ b/Assistant/WebApp/Configurators/IA.hs @@ -107,7 +107,7 @@ iaCredsAForm defcreds = AWS.AWSCreds #ifdef WITH_S3 previouslyUsedIACreds :: Annex (Maybe CredPair) previouslyUsedIACreds = previouslyUsedCredPair AWS.creds S3.remote $ - AWS.isIARemoteConfig . Remote.config + S3.isIA . Remote.config #endif accessKeyIDFieldWithHelp :: Maybe Text -> MkAForm Text diff --git a/Remote/S3.hs b/Remote/S3.hs index 5a956a5dfd..4b60b2bfcd 100644 --- a/Remote/S3.hs +++ b/Remote/S3.hs @@ -5,7 +5,7 @@ - Licensed under the GNU GPL version 3 or higher. -} -module Remote.S3 (remote, iaHost, isIA, isIAHost, iaItemUrl) where +module Remote.S3 (remote, iaHost, isIA, iaItemUrl) where import Network.AWS.AWSConnection import Network.AWS.S3Object hiding (getStorageClass) @@ -72,8 +72,12 @@ gen r u c gc = new <$> remoteCost gc expensiveRemoteCost availability = GloballyAvailable, remotetype = remote, mkUnavailable = gen r u (M.insert "host" "!dne!" c) gc, - getInfo = includeCredsInfo c (AWS.creds u) - [ ("bucket", fromMaybe "unknown" (getBucket c)) ] + getInfo = includeCredsInfo c (AWS.creds u) $ catMaybes + [ Just ("bucket", fromMaybe "unknown" (getBucket c)) + , if isIA c + then Just ("internet archive item", iaItemUrl $ fromMaybe "unknown" $ getBucket c) + else Nothing + ] } s3Setup :: Maybe UUID -> Maybe CredPair -> RemoteConfig -> Annex (RemoteConfig, UUID)