Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

userMetadata value exception: Unexpected char 0x5546 at 0 in x-amz-meta-tag value: 商品 #1078

Closed
jobmission opened this issue Oct 19, 2020 · 2 comments

Comments

@jobmission
Copy link

// sample code
MinioClient minioClient = MinioClient.builder().endpoint("https://play.min.io").credentials("Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG").build();
ByteArrayInputStream bais = new ByteArrayInputStream(“abcd”);
Map<String, String> userMetadata = new HashMap<>();
userMetadata.put("tag", "商品");
ObjectWriteResponse objectWriteResponse = minioClient.putObject(
PutObjectArgs.builder().bucket("zhangsan").object("my-objectname").stream(
bais, bais.available(), -1)
.userMetadata(userMetadata)
.build());

the method .userMetadata(userMetadata) call requestBuilder.header(entry.getKey(), entry.getValue()); , okhttp check header name and value ascii, but my userMetadata value contains chineses words , okhttp Headers.Builder.addUnsafeNonAscii only check name ascii;
@line

requestBuilder.header(entry.getKey(), entry.getValue());
,
Replacing Request.Builder.header(String name, String value) with okhttp Headers.Builder.addUnsafeNonAscii and Request.Builder.headers(Headers headers) may solve my problem .

Hope to understand my poor English expression .

@balamurugana
Copy link
Member

Fixed by #1079

@jobmission
Copy link
Author

Thank you very much for such a quick code submission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants