mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Fix incorrect conversion of JS template variable containing path #2657
This commit is contained in:
parent
8920cb7491
commit
26c59c251c
2 changed files with 11 additions and 1 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -676,6 +676,16 @@ class TemplateParserV2Test extends \Codeception\Test\Unit
|
|||
$source = '<p class="url(foo.svg)" style="url(../foo.jpg)"> url(img/foo.jpg); } </p>';
|
||||
$target = '<p class="url(foo.svg)" style="url(' . $this->baseurl . 'tests/_data/foo.jpg)"> url(img/foo.jpg); } </p>';
|
||||
$this->assertEquals($target, $this->_parse($source));
|
||||
|
||||
// No conversion if it's a template variable
|
||||
$source = '<img src="{ get_image_path(\'foo/bar.jpg\') }" />';
|
||||
$target = '<img src="{ get_image_path(\'foo/bar.jpg\') }" />';
|
||||
$this->assertEquals($target, $this->_parse($source));
|
||||
|
||||
// No conversion if it's a JS template variable
|
||||
$source = '@verbatim let src = `<source src="${foo.url}" />` @endverbatim';
|
||||
$target = ' let src = `<source src="${foo.url}" />` ';
|
||||
$this->assertEquals($target, $this->_parse($source));
|
||||
}
|
||||
|
||||
public function testBlockConditions()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue