mirror of
https://github.com/nextcloud/server.git
synced 2026-05-22 01:55:56 -04:00
fix(L10N): stop stripping _ from language codes
Stripping the underscore breaks support for all languages like de_AT, de_DE and so on... Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
This commit is contained in:
parent
14ba817034
commit
7b92145f7c
2 changed files with 2 additions and 1 deletions
|
|
@ -146,7 +146,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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,6 +94,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'],
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in a new issue