Claus Ibsen created CAMEL-27871:
-----------------------------------
Summary: camel-aws2-s3: removePrefixOnMove fails with
destinationBucketPrefix, a custom inProgressRepository is not started,
useAwsKMS differs between upload paths
Key: CAMEL-27871
URL: https://issues.apache.org/jira/browse/CAMEL-27871
Project: Camel
Issue Type: Bug
Components: camel-aws2-s3
Reporter: Claus Ibsen
Fix For: 4.25.0
Found while improving the option descriptions of camel-aws2-s3 for CAMEL-23832
(pull request https://github.com/apache/camel/pull/31149).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. removePrefixOnMove does not work with destinationBucketPrefix
{{AWS2S3Consumer.processCommit}} strips the prefix from destinationBucketPrefix
+ key + destinationBucketSuffix, so with a destination prefix it never matches,
and the documented example (demo/notify to demo/archive/example.txt) does not
work.
Proposed change: strip the prefix from the key before adding the destination
prefix and suffix.
h4. 2. A custom inProgressRepository is not started, and policy is only applied
to a new bucket
{{AWS2S3Endpoint.doStart}} returns early when fileName is set or the bucket
exists, so ServiceHelper.startService(inProgressRepository) is skipped (a JDBC
or Infinispan repository is never started), and policy is only applied right
after the bucket is created.
Proposed change: start the repository before the bucket checks, and apply the
policy independently of the creation.
h4. 3. useAwsKMS without awsKMSKeyId differs between upload paths
doPutObject and copyObject set SSE-KMS only when awsKMSKeyId is not empty,
while {{AWS2S3Utils.setEncryption}} (multipart and streaming upload) always
sets aws:kms with a null key id. So useAwsKMS=true without a key id is ignored
for PutObject but uses the aws/s3 key for multipart.
Proposed change: set aws:kms whenever useAwsKMS is true, and the key id only
when given.
h4. 4. The presigner does not follow the credential rules of the client
{{AWS2S3Producer.getOrCreatePresigner}} calls
AwsBasicCredentials.create(accessKey, secretKey) when no credential flag is
set, also with null keys, so createDownloadLink/createUploadLink fail with an
amazonS3Client and no keys instead of using the default chain; it also uses
uriEndpointOverride when overrideEndpoint=false.
Proposed change: reuse the credential and endpoint rules of
AwsClientBuilderUtil.
h4. 5. headObject does not send the SSE-C key
The headObject operation never sets the customer key headers when
useCustomerKey=true, so HEAD of an SSE-C object fails with 400.
Proposed change: add the SSE-C parameters as for getObject.
h4. 6. autoCreateBucket does not create the bucket on a 403
{{AWS2S3Endpoint.doStart}} throws when HeadBucket returns 403 with
autoCreateBucket=true, while the code comment suggests it should try to create
the bucket.
Proposed change: decide the intended behavior and align code and comment.
h4. 7. Service URL with forcePathStyle has a double dot
{{AWS2S3Endpoint.getServiceUrl}} builds "s3.<region>..amazonaws.com" when
forcePathStyle is on.
Proposed change: remove the extra dot.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)