Skip to content

[Bug]: <AWSS3SigV4JavaSamples.zip has upload bug> #6799

Open
@sanhe-qigai

Description

@sanhe-qigai

Expected behavior

Hello, I found a bug in the package "AWSS3SigV4JavaSamples.zip".
I downloaded this package from "https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-examples-using-sdks.html#sig-v4-examples-using-sdk-java".
when i upload to s3 ,I use PutS3ObjectSample.java

Actual behavior

XAmzContentSHA256MismatchThe provided 'x-amz-content-sha256' header does not match what was computed.2efb07c3c3e1b736f4e12f249f63976829ff012cd7ef40a70b6e3ee6344e12172dd6d43a7a0748921c3fffee5687a3f28b51ded41e00fbb98926919db9d3aca36FFBPMHDEJM59CRFMvcUeKbrglSYeu72DE825vxqyBPSOu85K8bn8NSCGe+Cp+tmyjSl5qzuvkSXOB/CI5J1ZLdy9fg=

Steps to reproduce

Specifically, in "HttpUtils.invokeHttpRequest", "wr.writeBytes(requestBody)" will cause the server to calculate hash256 incorrectly when the content contains Chinese characters.

Logs / stacktrace (if applicable)

It is recommended to change it to "wr.write(requestBody.getBytes(StandardCharsets.UTF_8))"

Which SDK were you using?

Java

Which OS were you using?

macOS

SDK version

No response

OS version

No response

Metadata

Metadata

Assignees

Labels

BugAn update to fix incorrect code or typos.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions