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 2024/09/04 05:33:53 UTC

(camel) branch s3 created (now 4e36c47d201)

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

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


      at 4e36c47d201 CAMEL-21161: camel-aws2-s3 is uploading always files as multipart when multiPartUpload is set true. Thanks to Guillem Folch for the patch.

This branch includes the following new commits:

     new 4e36c47d201 CAMEL-21161: camel-aws2-s3 is uploading always files as multipart when multiPartUpload is set true. Thanks to Guillem Folch for the patch.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(camel) 01/01: CAMEL-21161: camel-aws2-s3 is uploading always files as multipart when multiPartUpload is set true. Thanks to Guillem Folch for the patch.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4e36c47d2010f28f8709a96bf87169759c5deac1
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Sep 4 07:33:18 2024 +0200

    CAMEL-21161: camel-aws2-s3 is uploading always files as multipart when multiPartUpload is set true. Thanks to Guillem Folch for the patch.
---
 .../main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
index a22c7c428d8..8b687acb2bc 100644
--- a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
+++ b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
@@ -149,7 +149,7 @@ public class AWS2S3Producer extends DefaultProducer {
         }
 
         long partSize = getConfiguration().getPartSize();
-        if (contentLength == 0 && contentLength < partSize) {
+        if (contentLength == 0 || contentLength < partSize) {
             // optimize to do a single op if content length is known and < part size
             LOG.debug("File size < partSize. Uploading file in single operation: {}", filePayload);
             processSingleOp(exchange);
@@ -161,6 +161,7 @@ public class AWS2S3Producer extends DefaultProducer {
         objectMetadata.put("Content-Length", contentLength.toString());
 
         final String keyName = AWS2S3Utils.determineKey(exchange, getConfiguration());
+        final String bucketName = AWS2S3Utils.determineBucketName(exchange, getConfiguration());
         CreateMultipartUploadRequest.Builder createMultipartUploadRequest
                 = CreateMultipartUploadRequest.builder().bucket(getConfiguration().getBucketName()).key(keyName);
 
@@ -254,6 +255,7 @@ public class AWS2S3Producer extends DefaultProducer {
         Message message = getMessageForResponse(exchange);
         message.setHeader(AWS2S3Constants.E_TAG, uploadResult.eTag());
         message.setHeader(AWS2S3Constants.PRODUCED_KEY, keyName);
+        message.setHeader(AWS2S3Constants.PRODUCED_BUCKET_NAME, bucketName);
         if (uploadResult.versionId() != null) {
             message.setHeader(AWS2S3Constants.VERSION_ID, uploadResult.versionId());
         }