fix(next/form): normalize newlines in GET submissions - #98587
Open
sohailsk0160 wants to merge 1 commit into
Open
fix(next/form): normalize newlines in GET submissions#98587sohailsk0160 wants to merge 1 commit into
sohailsk0160 wants to merge 1 commit into
Conversation
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.
What?
Fix
next/formGET submissions so newline characters are normalized consistently with native HTML form submissions after hydration.Why?
When a textarea was submitted through a hydrated
next/formwith a string action, newline characters were sent as LF (\n).Native
application/x-www-form-urlencodedGET forms normalize standalone CR and LF characters to CRLF (\r\n) before URL encoding. This caused native forms and hydratednext/formcomponents to submit different values for identical textarea content.How?
Normalize form entry names and string values to CRLF before appending them to the target URL's search parameters.
Existing file-input handling remains unchanged because native form submission uses the file name directly.
Added end-to-end coverage for:
next/formsubmissionsTesting
git diff --check: passedRelated Issue
Fixes #98405