summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-05-27 20:31:25 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-05-27 20:31:25 -0400
commit421362932d2add993c03b9d28c019898b2ca1b90 (patch)
tree89a4993147eec2442f1d02bd3564cc17289e515e /Remote
parent9705e51f027bd6b8d706d07af6df6c870c25721c (diff)
fix dodgy use of Char8
I don't know if this was a bug, but I don't know if it was not a bug either. See also, http://git-annex.branchable.com/bugs/Truncated_file_transferred_via_S3/ where the file is not truncated, but mangled..
Diffstat (limited to 'Remote')
-rw-r--r--Remote/S3.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/Remote/S3.hs b/Remote/S3.hs
index c1a99abcd..796800a7b 100644
--- a/Remote/S3.hs
+++ b/Remote/S3.hs
@@ -12,7 +12,8 @@ import Network.AWS.S3Object hiding (getStorageClass)
import Network.AWS.S3Bucket hiding (size)
import Network.AWS.AWSResult
import qualified Data.Text as T
-import qualified Data.ByteString.Lazy.Char8 as L
+import qualified Data.Text.Encoding as T
+import qualified Data.ByteString.Lazy as L
import qualified Data.Map as M
import Data.Char
import Network.Socket (HostName)
@@ -286,13 +287,13 @@ writeUUIDFile c u = do
go conn =<< liftIO (tryNonAsync $ getObject conn $ mkobject L.empty)
where
go _conn (Right (Right o)) = unless (obj_data o == uuidb) $
- error $ "This bucket is already in use by a different S3 special remote, with UUID: " ++ L.unpack (obj_data o)
+ error $ "This bucket is already in use by a different S3 special remote, with UUID: " ++ show (obj_data o)
go conn _ = do
let object = setStorageClass (getStorageClass c) (mkobject uuidb)
either s3Error return =<< liftIO (sendObject conn object)
file = filePrefix c ++ "annex-uuid"
- uuidb = L.pack $ fromUUID u
+ uuidb = L.fromStrict $ T.encodeUtf8 $ T.pack $ fromUUID u
bucket = fromJust $ getBucket c
mkobject = S3Object bucket file "" (getXheaders c)