You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2025/02/05 06:47:10 UTC

(camel) branch main updated: CAMEL-21701: Make single file upload easy to access from message body

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 58db5a0258f CAMEL-21701: Make single file upload easy to access from message body
58db5a0258f is described below

commit 58db5a0258f44f29bb2ea7aede3dca989762b570
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Feb 5 07:46:57 2025 +0100

    CAMEL-21701: Make single file upload easy to access from message body
---
 .../component/platform/http/vertx/VertxPlatformHttpConsumer.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
index 741e87a0534..1566f6e2c80 100644
--- a/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
+++ b/components/camel-platform-http-vertx/src/main/java/org/apache/camel/component/platform/http/vertx/VertxPlatformHttpConsumer.java
@@ -355,8 +355,11 @@ public class VertxPlatformHttpConsumer extends DefaultConsumer
                 attachmentMessage.addAttachment(name, new DataHandler(new CamelFileDataSource(localFile, fileName)));
 
                 // populate body in case there is only one attachment
-                if (uploads.size() == 1 && message.getBody() == null) {
-                    message.setHeader(Exchange.FILE_NAME, localFile.getName());
+                if (uploads.size() == 1) {
+                    message.setHeader(Exchange.FILE_NAME, upload.fileName());
+                    if (upload.contentType() != null) {
+                        message.setHeader(Exchange.CONTENT_TYPE, upload.contentType());
+                    }
                     message.setBody(localFile);
                 }
             } else {