Skip to content
Permalink
Browse files

Fix auto linking urls with subdomain with underscore.

Closes #3392
  • Loading branch information...
ADmad committed Apr 25, 2014
1 parent 00be120 commit 27699d1f1252ff634b0b578959b2be3e05315862
Showing with 5 additions and 1 deletion.
  1. +4 −0 lib/Cake/Test/Case/View/Helper/TextHelperTest.php
  2. +1 −1 lib/Cake/View/Helper/TextHelper.php
@@ -265,6 +265,10 @@ public static function autoLinkProvider() {
'Text with a url http://www.not--work.com and more',
'Text with a url <a href="http://www.not--work.com">http://www.not--work.com</a> and more',
),
array(
'Text with a url http://www.sub_domain.domain.pl and more',
'Text with a url <a href="http://www.sub_domain.domain.pl">http://www.sub_domain.domain.pl</a> and more',
),
array(
'Text with a partial www.küchenschöhn-not-working.de URL',
'Text with a partial <a href="http://www.küchenschöhn-not-working.de">www.küchenschöhn-not-working.de</a> URL'
@@ -104,7 +104,7 @@ public function autoLinkUrls($text, $options = array()) {
$this->_placeholders = array();
$options += array('escape' => true);
$pattern = '#(?<!href="|src="|">)((?:https?|ftp|nntp)://[\p{L}0-9.\-:]+(?:[/?][^\s<]*)?)#ui';
$pattern = '#(?<!href="|src="|">)((?:https?|ftp|nntp)://[\p{L}0-9.\-_:]+(?:[/?][^\s<]*)?)#ui';
$text = preg_replace_callback(
$pattern,
array(&$this, '_insertPlaceHolder'),

0 comments on commit 27699d1

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.