]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Allow @ signs in the path, querystring, and fragment parts of URLs
authorCraig Andrews <candrews@integralblue.com>
Fri, 11 Sep 2009 01:19:38 +0000 (21:19 -0400)
committerCraig Andrews <candrews@integralblue.com>
Fri, 11 Sep 2009 01:19:38 +0000 (21:19 -0400)
lib/util.php
tests/URLDetectionTest.php

index 292045928dddc5d791faf22c030e984c856db618..b831859e993392d14de493f3ae349d9e61e919e2 100644 (file)
@@ -442,9 +442,9 @@ function common_replace_urls_callback($text, $callback, $notice_id = null) {
         ')'.
         '(?:'.
             '(?:\:\d+)?'. //:port
-            '(?:/[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"]*)?'. // /path
-            '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\/]*)?'. // ?query string
-            '(?:\#[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\/\?\#]*)?'. // #fragment
+            '(?:/[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@]*)?'. // /path
+            '(?:\?[\pN\pL\$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"@\/]*)?'. // ?query string
+            '(?:\#[\pN\pL$\[\]\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\"\@/\?\#]*)?'. // #fragment
         ')(?<![\?\.\,\#\,])'.
     ')'.
     '#ixu';
index 87b53764679db95d990bda94faa296be0dd6b490..1c3f7cd96f073d64a8eede2527f61af14ef5aaef 100644 (file)
@@ -27,6 +27,8 @@ class URLDetectionTest extends PHPUnit_Framework_TestCase
         return array(
                      array('not a link :: no way',
                            'not a link :: no way'),
+                     array('link http://www.somesite.com/xyz/35637563@N00/52803365/ link',
+                           'link <a href="http://www.somesite.com/xyz/35637563@N00/52803365/" rel="external">http://www.somesite.com/xyz/35637563@N00/52803365/</a> link'),
                      array('http://127.0.0.1',
                            '<a href="http://127.0.0.1/" rel="external">http://127.0.0.1</a>'),
                      array('127.0.0.1',