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..
This commit is contained in:
parent
b197ec8917
commit
0c2a14e4aa
1 changed files with 4 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue