Skip to content

Commit

Permalink
Fix auto linking for URLs with uppercased protocol.
Browse files Browse the repository at this point in the history
Closes #9033
  • Loading branch information
ADmad committed Jun 25, 2016
1 parent 5552d07 commit 3e81238
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/View/Helper/TextHelper.php
Expand Up @@ -162,7 +162,7 @@ protected function _linkUrls($text, $htmlOptions)
$replace = [];
foreach ($this->_placeholders as $hash => $url) {
$link = $url;
if (!preg_match('#^[a-z]+\://#', $url)) {
if (!preg_match('#^[a-z]+\://#i', $url)) {
$url = 'http://' . $url;
}
$replace[$hash] = $this->Html->link($link, $url, $htmlOptions);
Expand Down
4 changes: 4 additions & 0 deletions tests/TestCase/View/Helper/TextHelperTest.php
Expand Up @@ -299,6 +299,10 @@ public static function autoLinkProvider()
'This is a test that includes www.wikipedia.org/wiki/Kanton_(Schweiz)#fragment',
'This is a test that includes <a href="http://www.wikipedia.org/wiki/Kanton_(Schweiz)#fragment">www.wikipedia.org/wiki/Kanton_(Schweiz)#fragment</a>',
],
[
'This is a test that includes Http://example.com/test.php?foo=bar text',
'This is a test that includes <a href="Http://example.com/test.php?foo=bar">Http://example.com/test.php?foo=bar</a> text',
],
[
'This is a test that includes http://example.com/test.php?foo=bar text',
'This is a test that includes <a href="http://example.com/test.php?foo=bar">http://example.com/test.php?foo=bar</a> text',
Expand Down

0 comments on commit 3e81238

Please sign in to comment.