Content disposition and content types are adding inside the uploaded json file through S3 presign url
Describe the bug
When i upload the json file to S3 bucket using presign url. below data is getting added inside the file body of json file.
Below is the data getting added when uploaded from postman and Insomnia tools respectively
----------------------------877876629424195648035655 Content-Disposition: form-data; name="file"; filename="sourceFile.json" Content-Type: application/json.
--X-INSOMNIA-BOUNDARY Content-Disposition: form-data; name=""; filename="sourceFile.json" Content-Type: application/json
Java code for generating pre-sign url :
public static String generateAWSPresignedUrlForBulk(final String spaceId, final AmazonS3 s3Client, final long timeToLive, final String bucket,
final String uuid, final String fileName, final HttpMethod httpMethod, String profile) {
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
final var expiration = getExpirationTime(timeToLive);
final var generatePreSignedUrlRequest = new GeneratePresignedUrlRequest(bucket, buildKey(spaceId, uuid, fileName)).withMethod(httpMethod)
.withExpiration(expiration);
LOGGER.info(\"generateBulkPostDocumentPreSignUrl: \" + generatePreSignedUrlRequest);
LOGGER.info(\"S3 Key is: \" + buildKey(spaceId, uuid, fileName));
return s3Client.generatePresignedUrl(generatePreSignedUrlRequest).toString();
}
SDK version used : aws-java-sdk-s3:1.11.792
Kindly need help in fixing this.
Expected Behavior
Content-Disposition: form-data; name="file"; filename="sourceFile.json" Content-Type: application/json.
this data should not be added in file body of uploaded json file
Current Behavior
----------------------------877876629424195648035655 Content-Disposition: form-data; name="file"; filename="sourceFile.json" Content-Type: application/json.
Above data is getting added in file body
Reproduction Steps
No clue on the code side
Possible Solution
No response
Additional Information/Context
No response
AWS Java SDK version used
aws-java-sdk-s3: 1.11.792
JDK version used
11
Operating System and version
Docker
Hello @madhubikkavolu1 ,
Thank you very much for your submission. Could you please provide your upload logic?
Best,
Yasmine
Hi @yasminetalby ,
We are uploading json file through postman tool using presign url which we generated using above java logic.
Best Regards, Madhu
Hello @madhubikkavolu1 ,
Thank you very much for providing this screenshot. This does not seems related to AWS Java SDK behavior.
I have done some research and it seems that it is the behavior to except: when using postman with body->form-data, Postman is adding the header to your file.
If you would like to receive guidance regarding this behavior here are the repository where you can open submission tickets: postmanlabs/postman-app-support
If you have any questions related to the use of s3 presigned url or AWS-JAVA SDK V1 please let me know,
Sincerely