Improve url regular expression

- Improve regex to process non-whitespace characters only
- Remove /s flag
This commit is contained in:
Chanyoung Oh 2021-01-07 13:16:19 +00:00 committed by GitHub
parent 96bbbcf4bc
commit adcbe248c5

View file

@ -449,7 +449,7 @@ class TemplateHandler
foreach ($url_list as &$url) { foreach ($url_list as &$url) {
// replace if url is not starting with the pattern // replace if url is not starting with the pattern
$url = preg_replace_callback( $url = preg_replace_callback(
'/^(?!(?:https?|file):\/\/|[\/\{])([^"]+)/is', '/^(?!(?:https?|file):\/\/|[\/\{])(\S+)/i',
array($this, '_replaceRelativePath'), array($this, '_replaceRelativePath'),
trim($url) trim($url)
); );