Repository navigation
Fall back to the default charset when the multipart charset is not supported - #1677
Open
17krishna8 wants to merge 1 commit into
Open
17krishna8 wants to merge 1 commit into
17krishna8 wants to merge 1 commit into
Conversation
…pported MultipartServletWebRequestImpl.parseFileParts() reads the character encoding of the request and hands it to Charset.forName() twice, once for the file upload and once for decoding the form field values. commons-fileupload2 also resolves the charset of the request context eagerly while it parses the parts. For a charset the platform does not know, e.g. a made-up name sent as the charset parameter of the Content-Type header, Charset.forName() throws and the parsing of the parts fails. Fall back to the same default a missing encoding already uses, the response request encoding of the application, and answer that encoding from the request context, so that the parts are still parsed.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1677 +/- ##
=========================================
Coverage 61.96% 61.96%
- Complexity 11286 11288 +2
=========================================
Files 1250 1250
Lines 48437 48444 +7
Branches 6796 6796
=========================================
+ Hits 30014 30020 +6
- Misses 15729 15731 +2
+ Partials 2694 2693 -1 🚀 New features to boost your workflow:
|
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.
Follow-up to #1675, which made
RequestUtils.getCharset()fall back to the default for a charset name that is not legal.MultipartServletWebRequestImpl.parseFileParts()reads the character encoding of the request and hands it toCharset.forName()twice, once for the file upload and once for decoding the form field values. commons-fileupload2 also resolves the charset of the request context eagerly while it parses the parts. For a charset the platform does not know, e.g. a made-up name sent as thecharsetparameter of theContent-Typeheader,Charset.forName()throws and the parsing of the parts fails.Fall back to the same default a missing encoding already uses, the response request encoding of the application, and answer that encoding from the request context, so that the parts are still parsed.