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.
This commit is contained in:
Joey Hess 2019-03-22 12:27:41 -04:00
parent 2a99d7ffc0
commit 06cbaa4233
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

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