Skip to content

Commit

Permalink
{link} disables URL checking
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jun 1, 2022
1 parent 2cbc947 commit e6a2af7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"nette/forms": "^3.0",
"nette/robot-loader": "^3.2",
"nette/security": "^3.0",
"latte/latte": "^2.10.2 || ^3.0",
"latte/latte": "^2.10.2 || ^3.0.1",
"tracy/tracy": "^2.6",
"mockery/mockery": "^1.0",
"phpstan/phpstan-nette": "^0.12"
Expand All @@ -41,7 +41,7 @@
"nette/di": "<3.0.7",
"nette/forms": "<3.0",
"nette/schema": "<1.2",
"latte/latte": "<2.7.1 || >=3.1",
"latte/latte": "<2.7.1 || >=3.1 || =3.0.0",
"tracy/tracy": "<2.5"
},
"autoload": {
Expand Down
1 change: 1 addition & 0 deletions src/Bridges/ApplicationLatte/Nodes/LinkNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public static function create(Tag $tag): ?static
$node->args = $tag->parser->parseArguments();
$node->modifier = $tag->parser->parseModifier();
$node->modifier->escape = true;
$node->modifier->check = false;
$node->mode = $tag->name;

if ($tag->isNAttribute()) {
Expand Down
4 changes: 2 additions & 2 deletions tests/Bridges.Latte3/expected/isLinkCurrent.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
echo '>n:href after n:class</a>

<a href="';
echo LR\Filters::escapeHtmlAttr(LR\Filters::safeUrl($this->global->uiControl->link('default'))) /* line 5 */;
echo LR\Filters::escapeHtmlAttr($this->global->uiControl->link('default')) /* line 5 */;
echo '"';
echo ($ʟ_tmp = array_filter([$presenter->isLinkCurrent() ? 'current' : null])) ? ' class="' . LR\Filters::escapeHtmlAttr(implode(" ", array_unique($ʟ_tmp))) . '"' : "" /* line 5 */;
echo '>href before n:class</a>

<a';
echo ($ʟ_tmp = array_filter([$presenter->isLinkCurrent() ? 'current' : null])) ? ' class="' . LR\Filters::escapeHtmlAttr(implode(" ", array_unique($ʟ_tmp))) . '"' : "" /* line 7 */;
echo ' href="';
echo LR\Filters::escapeHtmlAttr(LR\Filters::safeUrl($this->global->uiControl->link('default'))) /* line 7 */;
echo LR\Filters::escapeHtmlAttr($this->global->uiControl->link('default')) /* line 7 */;
echo '">href after n:class</a>

<a href="';
Expand Down
4 changes: 2 additions & 2 deletions tests/Bridges.Latte3/{link}.2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ Assert::match(<<<'EOD'
{link $action}
<a href="{plink $arr['link'], $arr['param']|nocheck}"></a>
<a href="{plink $arr['link'], $arr['param']}"></a>
<a href="{link default! 10, 'a' => 20, 'b' => 30|nocheck}"></a>
<a href="{link default! 10, 'a' => 20, 'b' => 30}"></a>
<a n:href="Homepage:"></a>
Expand Down

0 comments on commit e6a2af7

Please sign in to comment.