Skip to content

Commit

Permalink
fix double-encoding of external urls
Browse files Browse the repository at this point in the history
  • Loading branch information
euromark committed Jun 12, 2012
1 parent 5f0e096 commit b32edfe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
Expand Up @@ -333,6 +333,10 @@ public function testLink() {
'/a' '/a'
); );
$this->assertTags($result, $expected); $this->assertTags($result, $expected);

$result = $this->Html->link('http://www.example.org?param1=value1&param2=value2');
$expected = array('a' => array('href' => 'http://www.example.org?param1=value1&param2=value2'), 'http://www.example.org?param1=value1&param2=value2', '/a');
$this->assertTags($result, $expected);
} }


/** /**
Expand Down
3 changes: 2 additions & 1 deletion lib/Cake/View/Helper/HtmlHelper.php
Expand Up @@ -335,7 +335,8 @@ public function link($title, $url = null, $options = array(), $confirmMessage =
$url = $this->url($url); $url = $this->url($url);
} else { } else {
$url = $this->url($title); $url = $this->url($title);
$title = h(urldecode($url)); $title = htmlspecialchars_decode($url, ENT_QUOTES);
$title = h(urldecode($title));
$escapeTitle = false; $escapeTitle = false;
} }


Expand Down

0 comments on commit b32edfe

Please sign in to comment.