From 06cbaa4233aff238b187dfbfa93e0bc9f46245fd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 22 Mar 2019 12:27:41 -0400 Subject: [PATCH] fix back-compat with old git-annex Unfortunately, "port" has to be set by default, or the old git-annex will crash when trying to enable the S3 remote. So, when protocol=https is specified, it needs to override port=80, since it may be a default setting. --- Remote/S3.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Remote/S3.hs b/Remote/S3.hs index 371c1d0718..e1a4b1b06c 100644 --- a/Remote/S3.hs +++ b/Remote/S3.hs @@ -146,6 +146,7 @@ s3Setup' ss u mcreds c gc [ ("datacenter", T.unpack $ AWS.defaultRegion AWS.S3) , ("storageclass", "STANDARD") , ("host", AWS.s3DefaultHost) + , ("port", "80") , ("bucket", defbucket) ] @@ -581,7 +582,13 @@ s3Configuration c = cfg port = case M.lookup "port" c of Just s -> case reads s of - [(p, _)] -> p + [(p, _)] + -- Let protocol setting override + -- default port 80. + | p == 80 -> case cfgproto of + Just AWS.HTTPS -> 443 + _ -> p + | otherwise -> p _ -> giveup $ "bad S3 port value: " ++ s Nothing -> case cfgproto of Just AWS.HTTPS -> 443