Commit 5a436346 authored by git's avatar git Committed by Berdir

Issue #3051381 by Waldoswndrwrld, JeroenT: Allow optional regex check on first safe token value

parent 8b684be7
......@@ -339,7 +339,7 @@ class AliasCleaner implements AliasCleanerInterface {
// Only clean non-path tokens.
$config = $this->configFactory->get('pathauto.settings');
$safe_tokens = implode('|', (array) $config->get('safe_tokens'));
if (!preg_match('/:(' . $safe_tokens . ')(:|\]$)/', $token)) {
if (!preg_match('/(\[|\:)(' . $safe_tokens . ')(:|\]$)/', $token)) {
$replacements[$token] = $this->cleanString($value, $options);
}
}
......
......@@ -55,6 +55,7 @@ class PathautoTokenTest extends KernelTestBase {
'[example:login-url:relative]',
'[example:url:relative]',
'[example:safe]',
'[safe:example]',
];
$unsafe_tokens = [
'[example:path_part]',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment