From 773084c49bc0e302374528c8c10496b45c6064c3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 14 Sep 2018 12:25:23 -0400 Subject: [PATCH] S3: Fix url construction bug When the publicurl has been set to an url that does not end with a slash, we need to add one in between it and the rest of the url. As far as I can see, git-annex does not default to such publicurls; it's careful to end them with slashes. But this was observed in the wild, and there may be documentation that doesn't include the slash. And it's an easy mistake to make in any case. This commit was sponsored by Eric Drechsel on Patreon. --- CHANGELOG | 7 +++++++ Remote/S3.hs | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 0206702b02..07beb8f36e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +git-annex (6.20180914) UNRELEASED; urgency=medium + + * S3: Fix url construction bug when the publicurl has been set to an url + that does not end with a slash. + + -- Joey Hess Fri, 14 Sep 2018 12:20:19 -0400 + git-annex (6.20180913) upstream; urgency=medium * When --batch is used with matching options like --in, --metadata, diff --git a/Remote/S3.hs b/Remote/S3.hs index e1cc1b8b3b..83016d11e1 100644 --- a/Remote/S3.hs +++ b/Remote/S3.hs @@ -21,6 +21,7 @@ import qualified Data.ByteString.Lazy as L import qualified Data.ByteString as BS import qualified Data.Map as M import qualified Data.Set as S +import qualified System.FilePath.Posix as Posix import Data.Char import Network.Socket (HostName) import Network.HTTP.Conduit (Manager) @@ -690,7 +691,7 @@ awsPublicUrl info = genericPublicUrl $ "https://" ++ T.unpack (bucket info) ++ ".s3.amazonaws.com/" genericPublicUrl :: URLString -> BucketObject -> URLString -genericPublicUrl baseurl p = baseurl ++ p +genericPublicUrl baseurl p = baseurl Posix. p genCredentials :: CredPair -> IO AWS.Credentials genCredentials (keyid, secret) = AWS.Credentials