Skip to content

fix(boot): keep the script of an Accept-Language tag - #4035

Merged
marevol merged 1 commit into
mainfrom
fix/accept-language-script-subtag
Dec 4, 2026
Merged

marevol merged 1 commit into
mainfrom
fix/accept-language-script-subtag

Conversation

@marevol

@marevol marevol commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Problem

With the Tomcat update in fess-parent (11.0.27 to 11.0.29), Tomcat's default Accept-Language parser discards four-letter script subtags before Fess sees them:

Accept-Language now expected
zh-Hant (API error message) English Traditional Chinese
zh-Hans (API error message) English Simplified Chinese
zh-Hans-HK Traditional Chinese Simplified Chinese
zh-Hant (ui_locale of /api/v2/ui/config) zh, which the theme maps to zh-CN zh-Hant
sr-Latn (ui_locale) sr sr-Latn

The admin screens and the labels bound to zh_CN / zh_TW are affected in the same way. This undoes #3939 and #3745 for 15.10; 15.9.0 reads ui_locale correctly.

Change

FessBoot.main sets the system property org.apache.tomcat.util.http.parser.StandardAcceptLanguageParser=true unless it is already set, which selects Tomcat's parser based on Locale.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

  • New test in FessBootTest; the class passes.
  • Checked on a running Fess with the patched FessBoot: the Accept-Language cases above and the limit on the number of entries.

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.
@marevol marevol added this to the 15.10.0 milestone Dec 4, 2026
@marevol marevol added the bug label Dec 4, 2026
@marevol marevol self-assigned this Dec 4, 2026
@marevol
marevol merged commit 4c75eb3 into main Dec 4, 2026
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant