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

Allow users to set UTF-8 characters in Multipart Parts when they use addFormDataPart(...) #4576

Conversation

monkey-mas
Copy link
Collaborator

@monkey-mas monkey-mas commented Jan 27, 2019

Closes #4564

Currently the user is not allowed to set Non-ASCII characters to filename when calling addFormDataPart(...). When addFormDataPart(...) calls Part.createFormData(...), Headers.of(...), which rejects Non-ASCII characters, is executed. By employing Headers.Builder with addUnsafeNonAscii(...) when calling Part.createFormData(...), users can set Non-ASCII characters.

Use addUnsafeNonAscii(...) that was previously added to Headers.Builder[1].

[1] square#4296
…addFormDataPart(...)

Currently the user is not allowed to set Non-ASCII characters to `filename` when calling `addFormDataPart(...)`.
When `addFormDataPart(...)` calls `Part.createFormData(...)`, `Headers.of(...)`, which rejects Non-ASCII characters,
is executed. By employing `Headers.Builder` with 'addUnsafeNonAscii(...)' when calling `Part.createFormData(...)`,
users can set Non-ASCII characters.
"Content-Disposition", "file; filename=\"file2.gif\"",
"Content-Transfer-Encoding", "binary"),
new Headers.Builder()
.addUnsafeNonAscii("Content-Disposition", "file; filename=\"file2€.gif\"")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this out into a separate targeted test and leave the existing test unchanged? The new test can be shorter and just focus on length and filename encoding.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I undid the change. Do you think I can even remove expected to do assertEquals(expected, buffer.readUtf8())?

@swankjesse
Copy link
Collaborator

Thanks! Obsoleted by #4584

@swankjesse swankjesse closed this Feb 2, 2019
@monkey-mas monkey-mas deleted the allow-users-to-use-utf8-in-multipart-parts-header branch February 3, 2019 05:25
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

Successfully merging this pull request may close these issues.

3 participants