Fix base64 multipart uploads with line breaks - #1122
Open
justadityaraj wants to merge 2 commits into
Open
Conversation
Contributor
|
Why are you using a regex instead of a string ? |
Author
|
Because this is streaming input: |
Contributor
|
But formidable project only supports node lts |
Author
right, updated in fc38c60 to use separate string replacements for \r and \n preserving split chunk handling |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1120.
Problem
Base64 multipart bodies may contain CRLF line wrapping. Formidable counted those characters when choosing four-character decode chunks, so decoded file data could be truncated or corrupted.
Fix
Remove CRLF from base64 data before calculating the next quartet boundary. The multipart integration regression covers a line-wrapped base64 upload and verifies its decoded bytes.
User impact
Line-wrapped base64 uploads now preserve their original file contents.
Verification
node --experimental-vm-modules ./node_modules/jest/bin/jest.js --runInBand test/standalone/content-transfer-encoding.test.js— 2 tests passed, including the new regression.node --test ./test-node/**/*.test.js— 11 tests passed.node ./node_modules/eslint/bin/eslint.js --quiet src/plugins/multipart.js— passed.node ./node_modules/prettier/bin-prettier.js --check src/plugins/multipart.js test/standalone/content-transfer-encoding.test.js— passed.pnpm run build-package— Rollup build passed.Greptile Summary
The PR updates multipart base64 decoding to remove embedded CR and LF characters before calculating complete decode quartets, preserving line-wrapped upload contents.
Confidence Score: 5/5
The PR appears safe to merge because no eligible blocking failure remains.
No blocking failure remains.
Important Files Changed
Sequence Diagram
Reviews (2): Last reviewed commit: "refactor: use replaceAll for base64 line..." | Re-trigger Greptile
Context used: