Add check for null values for incoming params

This commit is contained in:
Fedor A. Fetisov 2023-05-24 16:43:27 +03:00
parent 1ed31ad638
commit 5fa9663d99
3 changed files with 3 additions and 0 deletions

View File

@ -39,6 +39,7 @@ class TranslationController extends AbstractController
$operator = $this->getOperator();
$target = $request->query->get('target');
$target = is_null($target) ? '' : $target;
if (!preg_match("/^[\w-]{2,5}$/", $target)) {
$target = get_current_locale();
}

View File

@ -40,6 +40,7 @@ class TranslationExportController extends AbstractController
$operator = $this->getOperator();
$target = $request->request->get('target');
$target = is_null($target) ? '' : $target;
if (!preg_match("/^[\w-]{2,5}$/", $target)) {
$target = get_current_locale();
}

View File

@ -38,6 +38,7 @@ class TranslationImportController extends AbstractController
$operator = $this->getOperator();
$target = $request->request->get('target');
$target = is_null($target) ? '' : $target;
if (!preg_match("/^[\w-]{2,5}$/", $target)) {
$target = get_current_locale();
}