Handle blank Accept-Language header in AcceptHeaderLocaleResolver#36513
Closed
elgunshukurov wants to merge 1 commit intospring-projects:7.0.xfrom
Closed
Conversation
c08f39e to
017ed7a
Compare
Member
|
@elgunshukurov at this stage we try to avoid introducing behavior changes in the 6.2.x line. Can you rebase against 7.0.x please? |
017ed7a to
ac36fb5
Compare
ac36fb5 to
7d3bc31
Compare
Author
|
@bclozel done, rebased against 7.0.x. Thanks for the guidance. |
7d3bc31 to
f6fe557
Compare
When the Accept-Language header is present but blank, defaultLocale was ignored and fell back to Locale.getDefault() (JVM system locale). A blank header represents the same intent as an absent header. Closes spring-projectsgh-36513 Signed-off-by: elgun.shukurov <elgun.sukurov@kapitalbank.az>
f6fe557 to
4b21164
Compare
Member
|
Thanks for your contribution @elgunshukurov this has been merged in 7.0.x and main. |
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.
Problem
AcceptHeaderLocaleResolver.resolveLocale()correctly returnsdefaultLocalewhen the
Accept-Languageheader is absent (null), but ignores it when theheader is present with a blank value (
""), falling back toLocale.getDefault()(JVM system locale) instead.
Fix
Replace the
nullcheck with!StringUtils.hasText()which handlesnull,empty string, and whitespace-only values consistently.
Root cause
Closes gh-36512