Skip to content

Commit

Permalink
Updates to regex per feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
aembler committed Aug 5, 2021
1 parent 73d652c commit fd6ec76
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion concrete/blocks/external_form/controller.php
Expand Up @@ -78,7 +78,7 @@ public function validate($args)
$filenameToCheck = $filename; // We just check the entirety of what's passed in.
}

if (preg_match('/[^A-Za-z0-9_-]/i', $filenameToCheck)) {
if (!preg_match('/^[A-Za-z0-9_-]+$/i', $filenameToCheck)) {
$e->add(
t('External forms may only contain letters, numbers, dashes and underscores.')
);
Expand Down
2 changes: 1 addition & 1 deletion concrete/src/Block/Block.php
Expand Up @@ -1534,7 +1534,7 @@ public function updateBlockInformation($data)
$bFilenameToCheck = $bFilename; // We just check the entirety of what's passed in.
}

if (preg_match('/[^A-Za-z0-9_-]/i', $bFilenameToCheck)) {
if (!preg_match('/^[A-Za-z0-9_-]+$/i', $bFilenameToCheck)) {
$bFilename = null;
throw new \RuntimeException(
t('Custom templates may only contain letters, numbers, dashes and underscores.')
Expand Down

0 comments on commit fd6ec76

Please sign in to comment.