oscerd commented on code in PR #26842:
URL: https://github.com/apache/camel/pull/26842#discussion_r4102930122


##########
components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/utils/AWS2S3Utils.java:
##########
@@ -50,15 +50,16 @@ private AWS2S3Utils() {
     public static String determineBucketName(final Exchange exchange, 
AWS2S3Configuration configuration) {
         String bucketName = 
exchange.getIn().getHeader(AWS2S3Constants.OVERRIDE_BUCKET_NAME, String.class);
         if (ObjectHelper.isEmpty(bucketName)) {
+            // only the configured bucket name (supplied by the route) may be 
a dynamic simple expression;
+            // a bucket name provided through the header is used literally and 
never evaluated
             bucketName = configuration.getBucketName();

Review Comment:
   This is a straight backport of #26746, so I am keeping it aligned with what 
merged on `main`/`4.22.x` rather than adding backport-only changes. Good call 
on the Javadoc though — I am opening a separate follow-up on `main` to document 
the contract on `determineKey()`/`determineBucketName()` (a header-supplied 
key/bucket is used literally; only the configured `keyName`/`bucketName` may be 
a Simple expression), which will then flow to the maintenance branches.
   
   _Claude Code on behalf of Andrea Cosentino_



##########
components/camel-aws/camel-aws2-s3/src/test/java/org/apache/camel/component/aws2/s3/integration/S3GetObjectDynamicKeyOperationIT.java:
##########
@@ -81,7 +79,9 @@ protected RouteBuilder createRouteBuilder() {
             public void configure() {
                 context.setVariable("myVar", "myCamel");
 
-                String awsEndpoint = "aws2-s3://" + name.get() + 
"?autoCreateBucket=true";
+                // the dynamic key is a simple expression supplied through the 
endpoint configuration (keyName)
+                String awsEndpoint
+                        = "aws2-s3://" + name.get() + 
"?autoCreateBucket=true&keyName=RAW(${variable.global:myVar}.txt)";

Review Comment:
   Same clean-backport reasoning — not adding IT-only changes here that 
main/4.22.x do not have. The header-literal path is already covered at unit 
level (`AWS2S3UtilsTest#keyFromHeaderIsUsedLiterallyAndNotEvaluated` / 
`bucketFromOverrideHeaderIsUsedLiterallyAndNotEvaluated`); an end-to-end IT 
would need live S3/localstack and would duplicate that unit coverage, so I am 
leaving it out.
   
   _Claude Code on behalf of Andrea Cosentino_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to