[FIX] http_routing: restrict lang matching to installed lang
When accessing an URL, there is some computation to check if you try to access
a lang. Part of this job is to get the closest language available.
For instance, you could try to get `/fr_BE/..` and it would redirect to
`/fr_FR/..` if french is installed but not belgian french.
There is a known issue when loading files/assets from a module starting by the
same letter than a lang, in debug assets.
Only reported case was `hr_XXX` modules which would be redirected to `hr_HR`
lang (croatian).
So, the issue would only occur when:
1. Debug assets is enabled
2. hr_HR lang is activated
3. only hr_XX modules would be impacted
But since 269aa59411, the issue would appear even if `hr_HR` was not activated.
This commit restore the issue to its minimal case, when `hr_HR` lang is
activated.
closes odoo/odoo#37494
Signed-off-by: Olivier Dony (odo) <odo@openerp.com>
This commit is contained in:
@@ -302,11 +302,11 @@ class IrHttp(models.AbstractModel):
|
||||
""" Try to find a similar lang. Eg: fr_BE and fr_FR
|
||||
:param lang_code: the lang `code` (en_US)
|
||||
"""
|
||||
short_match = False
|
||||
if not lang_code:
|
||||
return short_match
|
||||
return False
|
||||
short_match = False
|
||||
short = lang_code.partition('_')[0]
|
||||
for code in [code for code, _, _ in request.env['res.lang'].get_available()]:
|
||||
for (code, _) in request.env['res.lang'].get_installed():
|
||||
if code == lang_code:
|
||||
return code
|
||||
if not short_match and code.startswith(short):
|
||||
|
||||
Reference in New Issue
Block a user