You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Kiril Nugmanov (Jira)" <ji...@apache.org> on 2020/10/13 10:47:00 UTC
[jira] [Updated] (CAMEL-15678) camel-aws2-s3 multipart upload
multiplies file by number of parts
[ https://issues.apache.org/jira/browse/CAMEL-15678?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kiril Nugmanov updated CAMEL-15678:
-----------------------------------
Summary: camel-aws2-s3 multipart upload multiplies file by number of parts (was: camel-aws2-s3 multipart upload multiplies file size by number of parts)
> camel-aws2-s3 multipart upload multiplies file by number of parts
> -----------------------------------------------------------------
>
> Key: CAMEL-15678
> URL: https://issues.apache.org/jira/browse/CAMEL-15678
> Project: Camel
> Issue Type: Bug
> Components: camel-aws2
> Affects Versions: 3.5.0
> Reporter: Kiril Nugmanov
> Priority: Minor
>
> Camel AWS2 S3 incorectly defines upload part content on multipart upload:
> {{org.apache.camel.component.aws2.s3.AWS2S3Producer:193}}
> {code:java}
> for (int part = 1; filePosition < contentLength; part++) {
> ...
> ...
> String etag = getEndpoint().getS3Client().uploadPart(uploadRequest, RequestBody.fromFile(filePayload)).eTag();
> ...
> }{code}
>
> {{filePayload}} - is whole file to be uploaded.
> In case when file size is bigger than {{partSize}} (which by default is 25MB) - uploaded amount of content to S3 will be {{file.size * number_of_parts}}
>
> Fix:
> * define {{RequsetBody}} from stream:
> {code:java}
> InputStream inputStream = FileUtils.openInputStream(file);
> IOUtils.skip(inputStream, filePosition);
> completedParts.add(
> CompletedPart.builder()
> .partNumber(part)
> .eTag(amazonS3Client.uploadPart(uploadRequest, RequestBody.fromInputStream(inputStream, partSize)).eTag())
> .build()
> ); {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)