davsclaus commented on code in PR #30472:
URL: https://github.com/apache/camel/pull/30472#discussion_r4639614496


##########
core/camel-core-processor/src/main/java/org/apache/camel/processor/transformer/ByteArrayDataTypeTransformer.java:
##########
@@ -28,23 +31,25 @@
 
 /**
  * Generic binary data type uses Camel message body converter mechanism to 
convert content to byte array representation.
- * A stream cache body is binary already and can be read again, so it is kept 
as it is: a large body, such as an object
- * read from a bucket, is not read into memory. Any other stream is read into 
a byte array, as it may be read only once.
+ * A stream cache or a file body is binary already and can be read again, so 
it is kept as it is: a large body, such as
+ * an object read from a bucket or a file to upload, is not read into memory. 
Any other stream is read into a byte
+ * array, as it may be read only once.
  */
 @DataTypeTransformer(name = "application-octet-stream")
 @BodyTypes(transformerIn = @BodyType(value = { Carrier.TEXT, Carrier.BYTES, 
Carrier.STREAM, Carrier.FILE, Carrier.NULL },
                                      description = "A body Camel can convert 
to a byte array: a number fails, and a null"
                                                    + " body stays null"),
-           transformerOut = @BodyType(value = { Carrier.BYTES, Carrier.STREAM, 
Carrier.NULL },
-                                      description = "A stream cache body is 
kept as it is and a null body stays null;"
-                                                    + " any other body becomes 
a byte array"))
+           transformerOut = @BodyType(value = { Carrier.BYTES, Carrier.STREAM, 
Carrier.FILE, Carrier.NULL },
+                                      description = "A stream cache or a file 
body is kept as it is and a null body"
+                                                    + " stays null; any other 
body becomes a byte array"))
 public class ByteArrayDataTypeTransformer extends Transformer {
 
     private static final Transformer DELEGATE = new 
TypeConverterTransformer(byte[].class);
 
     @Override
     public void transform(Message message, DataType from, DataType to) throws 
Exception {
-        if (!(message.getBody() instanceof StreamCache)) {
+        Object body = message.getBody();
+        if (!(body instanceof StreamCache || body instanceof File || body 
instanceof WrappedFile)) {

Review Comment:
   Fixed in fa8d941b3350: a `Path` body is kept too (imported, short name), 
with a `shouldKeepPath` test and `Path` named in the upgrade guide note.
   
   _Claude Code on behalf of davsclaus_



-- 
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