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

Core JS - Allow to send POST data as urlencoded instead of multipart form data #1452

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

sabieber
Copy link
Member

Description

Netty seems to replace some characters like commas, colons, semicolons, ... with spaces when reading the multipart form data in HttpPostMultipartRequestDecoder::getContentDispositionAttribute. This may be problematic when trying to match the parameter names to data.

To circumvent this in a non breaking fashion we add a new optional parameter that converts the FormData into an URLSearchParams object. This way data is sent with content type application/x-www-form-urlencoded instead of multipart/form-data.

see:
https://github.com/netty/netty/blob/4.1/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L875
https://github.com/netty/netty/blob/4.1/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L1293

Additional Notes

  • This PR fixes or works on following ticket(s): OX-10757

Checklist

  • Code change has been tested and works locally
  • Code was formatted via IntelliJ and follows SonarLint & best practices
  • Patch Tasks: Is local execution of Patch Tasks necessary? If so, please also mark the PR with the tag.

Netty seems to replace some characters like commas, colons, semicolons, ... with spaces when reading the multipart form data in `HttpPostMultipartRequestDecoder::getContentDispositionAttribute`.
This may be problematic when trying to match the parameter names to data.

To circumvent this in a non breaking fashion we add a new optional parameter that converts the FormData into an URLSearchParams object.
This way data is sent with content type `application/x-www-form-urlencoded` instead of `multipart/form-data`.

Fixes: OX-10757
@sabieber sabieber added 🧬 Enhancement Contains new features 👶🏻 Trivial Easy to review labels Aug 27, 2024
@sabieber sabieber merged commit 711b44e into develop Aug 27, 2024
5 checks passed
@sabieber sabieber deleted the feature/sbi/OX-10757 branch August 27, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧬 Enhancement Contains new features 👶🏻 Trivial Easy to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants