You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Andrea Cosentino (Jira)" <ji...@apache.org> on 2021/09/13 05:52:00 UTC

[jira] [Resolved] (CAMEL-16936) camel-aws2-s3: Not setting CONTENT-MD5 header which breaks putObject with object locks

     [ https://issues.apache.org/jira/browse/CAMEL-16936?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrea Cosentino resolved CAMEL-16936.
--------------------------------------
    Resolution: Fixed

> camel-aws2-s3: Not setting CONTENT-MD5 header which breaks putObject with object locks
> --------------------------------------------------------------------------------------
>
>                 Key: CAMEL-16936
>                 URL: https://issues.apache.org/jira/browse/CAMEL-16936
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-aws2-s3
>    Affects Versions: 3.11.0
>            Reporter: Dylan Sale
>            Assignee: Andrea Cosentino
>            Priority: Major
>             Fix For: 3.7.6, 3.11.3, 3.12.0
>
>
> I can't upload files to S3 when the bucket has an object lock because it requires the {{CONTENT-MD5}} header to be set on the message.
> The _AWS2S3Producer_ seems to have a bug where it only sets "Content-Md5" in the objectMetadata, but I think it needs to do something like:
> {quote}putObjectRequest.contentMD5(exchange.getIn().getHeader(AWS2S3Constants.CONTENT_MD5, String.class))
> {quote}
> when building the putRequest, similar to how the cannedACL is handled here: [https://github.com/apache/camel/blob/main/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java#L296] rather than just putting it in the objectMetadata.
> I have a workaround for now, I'm creating a bean that overrides the S3Client and configures it to always generate the MD5 hash.
> My workaround: 
> {code:java}
> bean() {
>         S3Client.builder()                            
>             .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKey, secretKey)))
>             .region(Region.of(region))
>             .overrideConfiguration(ClientOverrideConfiguration.builder().putExecutionAttribute(
>                 SdkInternalExecutionAttribute.HTTP_CHECKSUM_REQUIRED, HttpChecksumRequired.create()
>             ).build())
>             .build()
> }
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)