brendanhay / amazonka

A comprehensive Amazon Web Services SDK for Haskell.
https://amazonka.brendanhay.nz
Other
598 stars 227 forks source link

amazonka-s3: "empty" `content-encoding` value when using `putObject`. #914

Closed asheshambasta closed 1 year ago

asheshambasta commented 1 year ago

We've used:

    amazonka-s3-1.6.1

and noticed that when using putObject and not setting any value for poContentEncoding, the data being sent to aws contains an empty string for the content-encoding metadata in the resulting object.

I'm not entirely sure this is desired behaviour, but it seems odd. When a metadata field is set to Nothing, it should just not be set on AWS.

Here's an example trace for the generated PutObject:

PutObject'{
    _poContentLength = Nothing
  , _poExpires = Just (Time {fromTime = 2033-06-09 14:10:34.023043751 UTC})
  , _poGrantReadACP = Nothing
  , _poSSECustomerAlgorithm = Nothing
  , _poSSECustomerKey = Nothing
  , _poRequestPayer = Nothing
  , _poGrantWriteACP = Nothing
  , _poWebsiteRedirectLocation = Nothing
  , _poGrantRead = Nothing
  , _poStorageClass = Nothing
  , _poSSECustomerKeyMD5 = Nothing
  , _poSSEKMSKeyId = Nothing
  , _poGrantFullControl = Nothing
  , _poContentEncoding = Nothing
  , _poTagging = Just "optim=0"
  , _poContentMD5 = Nothing
  , _poMetadata = Map {toMap = fromList []}
  , _poCacheControl = Just "max-age: 315360000, public"
  , _poContentLanguage = Nothing
  , _poACL = Just OPublicRead
  , _poContentDisposition = Nothing
  , _poServerSideEncryption = Nothing
  , _poContentType = Just "image/jpeg"
  , _poBucket = BucketName "some-bucket"
  , _poKey = ObjectKey "some-obj.jpeg"
  , _poBody = Chunked ChunkedBody { chunkSize = ChunkSize 131072<> originalLength = 830<> fullChunks = 0<> remainderBytes = Just 830}
}
endgame commented 1 year ago

I don't think this is a problem on current main. amazonka-2.0 has had a lot of fixes over the past few years and I remember #681 in particular fixing empty content-encoding headers on s3:PutObject calls with chunked bodies.

Please see #716 for instructions on how to get amazonka from main into your project; a lot of people have moved across for production workloads.

If it recurs on main, please feel free to reopen or file a new issue.