Allow locales like de_DE in removeLocaleFromPath function

Related to issue #563
This commit is contained in:
Jan Böhmer 2024-06-22 19:47:55 +02:00
parent eb02404d49
commit 445229976f
2 changed files with 5 additions and 3 deletions

View file

@ -127,7 +127,7 @@ final class UserExtension extends AbstractExtension
public function removeLocaleFromPath(string $path): string
{
//Ensure the path has the correct format
if (!preg_match('/^\/\w{2}\//', $path)) {
if (!preg_match('/^\/\w{2}(?:_\w{2})?\//', $path)) {
throw new \InvalidArgumentException('The given path is not a localized path!');
}