Fix issue with link generation and no title.

Fix urlencoded text from being displayed in text of links.

Fixes #2387
This commit is contained in:
mark_story 2011-12-19 20:49:01 -05:00
parent ab2cf59b3d
commit 866177f37d
2 changed files with 13 additions and 1 deletions

View file

@ -185,12 +185,24 @@ class HtmlHelperTest extends CakeTestCase {
* @return void
*/
public function testLink() {
Router::connect('/:controller/:action/*');
$this->Html->request->webroot = '';
$result = $this->Html->link('/home');
$expected = array('a' => array('href' => '/home'), 'preg:/\/home/', '/a');
$this->assertTags($result, $expected);
$result = $this->Html->link(array('action' => 'login', '<[You]>'));
$expected = array(
'a' => array('href' => '/login/%3C%5BYou%5D%3E'),
'preg:/\/login\/&lt;\[You\]&gt;/',
'/a'
);
$this->assertTags($result, $expected);
Router::reload();
$result = $this->Html->link('Posts', array('controller' => 'posts', 'action' => 'index', 'full_base' => true));
$expected = array('a' => array('href' => FULL_BASE_URL . '/posts'), 'Posts', '/a');
$this->assertTags($result, $expected);

View file

@ -327,7 +327,7 @@ class HtmlHelper extends AppHelper {
$url = $this->url($url);
} else {
$url = $this->url($title);
$title = $url;
$title = h(urldecode($url));
$escapeTitle = false;
}