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

Fixup req form data file upload with "r\n" line endings #3137

Merged
merged 2 commits into from
Apr 30, 2023

Conversation

MSP-Greg
Copy link
Member

Description

Current code breaks when a form uploads a file with "\r\n" line endings.

Currently client.rb uses a string buffer that is initialized as UTF-8, it should be initialized as ASCII-8BIT. UTF-8 can be 'character/line-ending' sensitive, while ASCII-8BIT is just bytes...

Add two tests, both with "\r\n" line endings, one as BOM|UTF-8.

Closes Discussion #3131

Running the two new tests on master has the below errors:

  1) Error:
TestPumaServer#test_form_data_encoding_windows:
NoMethodError: undefined method `split' for nil
    puma/test/test_puma_server.rb:1629:in `test_form_data_encoding_windows'

  2) Error:
TestPumaServer#test_form_data_encoding_windows_bom:
NoMethodError: undefined method `split' for nil
    puma/test/test_puma_server.rb:1598:in `test_form_data_encoding_windows_bom'

Your checklist for this pull request

  • I have reviewed the guidelines for contributing to this repository.
  • I have added (or updated) appropriate tests if this PR fixes a bug or adds a feature.
  • My pull request is 100 lines added/removed or less so that it can be easily reviewed.
  • If this PR doesn't need tests (docs change), I added [ci skip] to the title of the PR.
  • If this closes any issues, I have added "Closes #issue" to the PR description or my commit messages.
  • I have updated the documentation accordingly.
  • All new and existing tests passed, including Rubocop.

MSP-Greg and others added 2 commits April 28, 2023 21:45
Co-authored-by: Martin Streicher <martin.streicher@gadget.consulting>
@MSP-Greg MSP-Greg added the bug label Apr 29, 2023
@MSP-Greg MSP-Greg merged commit 6f8fbe4 into puma:master Apr 30, 2023
63 checks passed
@MSP-Greg MSP-Greg deleted the 00-utf-8-bom branch April 30, 2023 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant