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


##########
components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/utils/AWS2S3Utils.java:
##########
@@ -137,16 +138,17 @@ public static byte[] toByteArray(InputStream is, final 
int size) throws IOExcept
     public static String determineKey(final Exchange exchange, 
AWS2S3Configuration configuration) {
         String key = exchange.getIn().getHeader(AWS2S3Constants.KEY, 
String.class);
         if (ObjectHelper.isEmpty(key)) {
+            // only the configured key (supplied by the route) may be a 
dynamic simple expression;
+            // a key provided through the header is used literally and never 
evaluated
             key = configuration.getKeyName();
+            if (key != null && hasSimpleFunction(key)) {

Review Comment:
   Good catch — addressed in 87eb51e:
   
   - Messages now read `AWS S3 Key is not set or resolved to null.` / `AWS S3 
Bucket name is not set or resolved to null.`, accurate for the 
configured-expression-resolves-to-null path.
   - Added `keyFromConfigurationResolvingToNullThrows` / 
`bucketFromConfigurationResolvingToNullThrows` covering the fail-fast (kept, 
since as you note failing at the producer beats a null key reaching S3).
   - Added an upgrade-guide line documenting this second behaviour change.
   
   On intent: this narrows CAMEL-20971, which you authored (`eabd31d`); header 
evaluation was incidental to where the evaluation sat relative to the 
header/config merge, and the IT was migrated to the configured `keyName` path 
rather than deleted.
   
   _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