diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index abe392335f5..a4ecadaf253 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -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); } diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php index bb43c68a219..d76c7591a07 100644 --- a/tests/lib/L10N/FactoryTest.php +++ b/tests/lib/L10N/FactoryTest.php @@ -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'], ];