Skip to content

Commit

Permalink
S3MH: use AsyncRequestBody.fromFile()
Browse files Browse the repository at this point in the history
Related to the fix for the aws/aws-sdk-java-v2#3839
  • Loading branch information
artembilan committed Feb 26, 2024
1 parent cd52fed commit f2aded0
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2023 the original author or authors.
* Copyright 2016-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,7 +22,6 @@
import java.util.concurrent.CompletionException;
import java.util.function.BiConsumer;

import org.apache.commons.io.FileUtils;
import software.amazon.awssdk.core.async.AsyncRequestBody;
import software.amazon.awssdk.core.internal.util.Mimetype;
import software.amazon.awssdk.services.s3.S3AsyncClient;
Expand Down Expand Up @@ -311,8 +310,7 @@ else if (payload instanceof File fileToUpload) {
if (putObjectRequest.contentType() == null) {
putObjectRequestBuilder.contentType(Mimetype.getInstance().getMimetype(fileToUpload));
}
// TODO until https://github.com/aws/aws-sdk-java-v2/issues/3839
requestBody = AsyncRequestBody.fromBytes(FileUtils.readFileToByteArray(fileToUpload));
requestBody = AsyncRequestBody.fromFile(fileToUpload);
}
else if (payload instanceof byte[] payloadBytes) {
if (putObjectRequest.contentMD5() == null) {
Expand Down

0 comments on commit f2aded0

Please sign in to comment.