Skip to content
Browse files

fix double-encoding of external urls

  • Loading branch information...
1 parent 5f0e096 commit b32edfe378f467531c24b432bc46283035682515 @dereuromark dereuromark committed Jun 12, 2012
Showing with 6 additions and 1 deletion.
  1. +4 −0 lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
  2. +2 −1 lib/Cake/View/Helper/HtmlHelper.php
View
4 lib/Cake/Test/Case/View/Helper/HtmlHelperTest.php
@@ -333,6 +333,10 @@ public function testLink() {
'/a'
);
$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);
}
/**
View
3 lib/Cake/View/Helper/HtmlHelper.php
@@ -335,7 +335,8 @@ public function link($title, $url = null, $options = array(), $confirmMessage =
$url = $this->url($url);
} else {
$url = $this->url($title);
- $title = h(urldecode($url));
+ $title = htmlspecialchars_decode($url, ENT_QUOTES);
+ $title = h(urldecode($title));
$escapeTitle = false;
}

0 comments on commit b32edfe

Please sign in to comment.
Something went wrong with that request. Please try again.