diff --git a/common/framework/Template.php b/common/framework/Template.php index 387c3ba6a..bd7d9165d 100644 --- a/common/framework/Template.php +++ b/common/framework/Template.php @@ -528,7 +528,7 @@ class Template */ public function isRelativePath(string $path): bool { - return !preg_match('#^((?:https?|file|data):|[\/\{<])#i', $path); + return !preg_match('#^((?:https?|file|data):|[\/\{\\\\<$\#@]|&\#x1B;)#i', $path); } /** diff --git a/tests/unit/framework/parsers/TemplateParserV2Test.php b/tests/unit/framework/parsers/TemplateParserV2Test.php index 9754800cf..0257ae05f 100644 --- a/tests/unit/framework/parsers/TemplateParserV2Test.php +++ b/tests/unit/framework/parsers/TemplateParserV2Test.php @@ -676,6 +676,16 @@ class TemplateParserV2Test extends \Codeception\Test\Unit $source = '
url(img/foo.jpg); }
'; $target = 'url(img/foo.jpg); }
'; $this->assertEquals($target, $this->_parse($source)); + + // No conversion if it's a template variable + $source = '
';
+ $target = '
';
+ $this->assertEquals($target, $this->_parse($source));
+
+ // No conversion if it's a JS template variable
+ $source = '@verbatim let src = `