]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Allow :'s in the path, query string, and fragment parts of the url (Mediawiki URLs...
authorCraig Andrews <candrews@integralblue.com>
Mon, 31 Aug 2009 14:33:37 +0000 (10:33 -0400)
committerCraig Andrews <candrews@integralblue.com>
Mon, 31 Aug 2009 14:33:37 +0000 (10:33 -0400)
lib/util.php
tests/URLDetectionTest.php

index 7228b3fe3e81ce755a0b715e93bd2b7f2ef98d51..6e79ffda4f971731cdf339d03ab9936e7122e293 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 fd697c2189062bd52812d2d84e78f07b001bdc10..9a103b6f7cbcc9a98035563ffd94e16e907c6b39 100644 (file)
@@ -31,8 +31,8 @@ class URLDetectionTest extends PHPUnit_Framework_TestCase
                            '<a href="http://127.0.0.1/" rel="external">127.0.0.1</a>'),
                      array('127.0.0.1:99',
                            '<a href="http://127.0.0.1:99/" rel="external">127.0.0.1:99</a>'),
-                     array('127.0.0.1/test.php',
-                           '<a href="http://127.0.0.1/test.php" rel="external">127.0.0.1/test.php</a>'),
+                     array('127.0.0.1/Name:test.php',
+                           '<a href="http://127.0.0.1/Name:test.php" rel="external">127.0.0.1/Name:test.php</a>'),
                      array('127.0.0.1/~test',
                            '<a href="http://127.0.0.1/~test" rel="external">127.0.0.1/~test</a>'),
                      array('127.0.0.1/test%20stuff',