Merge pull request #58575 from nextcloud/backport/58571/stable33

[stable33] fix(L10N): stop stripping _ from language codes
This commit is contained in:
Salvatore Martire 2026-02-26 11:03:29 +01:00 committed by GitHub
commit 133ec8fc72
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -144,7 +144,7 @@ class Factory implements IFactory {
if ($lang === null) {
return null;
}
$lang = preg_replace('/[^a-zA-Z0-9.;,=-]/', '', $lang);
$lang = preg_replace('/[^a-zA-Z0-9.;,=_-]/', '', $lang);
return str_replace('..', '', $lang);
}

View file

@ -95,6 +95,7 @@ class FactoryTest extends TestCase {
return [
'null shortcut' => [null, null],
'default language' => ['de', 'de'],
'regional language' => ['de_DE', 'de_DE'],
'malicious language' => ['de/../fr', 'defr'],
'request language' => ['kab;q=0.8,ka;q=0.7,de;q=0.6', 'kab;q=0.8,ka;q=0.7,de;q=0.6'],
];