Repository navigation
fix(boot): keep the script of an Accept-Language tag - #4035
Merged
Merged
Conversation
Since Tomcat 11.0.29 the default Accept-Language parser discards the script subtag, so zh-Hant arrives as zh and sr-Latn as sr: Chinese readers who send only a script are answered in English, and the theme shows Simplified Chinese to zh-Hant. FessBoot now selects Tomcat's standard parser unless the system property is already set.
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
With the Tomcat update in fess-parent (11.0.27 to 11.0.29), Tomcat's default
Accept-Languageparser discards four-letter script subtags before Fess sees them:Accept-Languagezh-Hant(API error message)zh-Hans(API error message)zh-Hans-HKzh-Hant(ui_localeof/api/v2/ui/config)zh, which the theme maps tozh-CNzh-Hantsr-Latn(ui_locale)srsr-LatnThe admin screens and the labels bound to
zh_CN/zh_TWare affected in the same way. This undoes #3939 and #3745 for 15.10; 15.9.0 readsui_localecorrectly.Change
FessBoot.mainsets the system propertyorg.apache.tomcat.util.http.parser.StandardAcceptLanguageParser=trueunless it is already set, which selects Tomcat's parser based onLocale.forLanguageTag. The Javadoc of the locale count limit is updated for the new Tomcat behaviour (entries over the limit are dropped).A WAR deployed into an external Tomcat does not go through
FessBoot; there the property has to be set on the JVM.Tests
FessBootTest; the class passes.FessBoot: theAccept-Languagecases above and the limit on the number of entries.