mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-10-26 06:43:15 +08:00
detectLanguage tested whether "zh" appeared anywhere in the header, so any
visitor whose Accept-Language mentions Chinese got the Chinese UI regardless of
preference.
en-US,en;q=0.9,zh;q=0.5 -> zh, expected en
zh;q=0, en -> zh, expected en
The first is a bilingual visitor who prefers English and lists Chinese as a
fallback. The second sets q=0, which RFC 7231 defines as not acceptable.
Now parses q, drops q=0, sorts descending, and matches the primary subtag rather
than a substring. Chinese still wins whenever it is actually preferred.
The two existing assertions are unchanged and still pass.
Signed-off-by: lukiod <mohakgupta0981@gmail.com>