From 3368452ebf3c738933b05e902c277296684e280b Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Fri, 28 Aug 2009 16:18:05 -0400 Subject: Add % and ~ as valid characters in the path, querystring, and fragment parts of URLs --- tests/URLDetectionTest.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/URLDetectionTest.php') diff --git a/tests/URLDetectionTest.php b/tests/URLDetectionTest.php index 767f895bb..fd697c218 100644 --- a/tests/URLDetectionTest.php +++ b/tests/URLDetectionTest.php @@ -33,6 +33,10 @@ class URLDetectionTest extends PHPUnit_Framework_TestCase '127.0.0.1:99'), array('127.0.0.1/test.php', '127.0.0.1/test.php'), + array('127.0.0.1/~test', + '127.0.0.1/~test'), + array('127.0.0.1/test%20stuff', + '127.0.0.1/test%20stuff'), array('http://[::1]:99/test.php', 'http://[::1]:99/test.php'), array('http://::1/test.php', -- cgit v1.2.3-54-g00ecf From 20423af689fbf4dd139e1254dc49ae3df1db0de2 Mon Sep 17 00:00:00 2001 From: Craig Andrews Date: Mon, 31 Aug 2009 10:33:37 -0400 Subject: Allow :'s in the path, query string, and fragment parts of the url (Mediawiki URLs often do this) --- lib/util.php | 6 +++--- tests/URLDetectionTest.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'tests/URLDetectionTest.php') diff --git a/lib/util.php b/lib/util.php index 7228b3fe3..6e79ffda4 100644 --- a/lib/util.php +++ b/lib/util.php @@ -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 ')(?127.0.0.1'), array('127.0.0.1:99', '127.0.0.1:99'), - array('127.0.0.1/test.php', - '127.0.0.1/test.php'), + array('127.0.0.1/Name:test.php', + '127.0.0.1/Name:test.php'), array('127.0.0.1/~test', '127.0.0.1/~test'), array('127.0.0.1/test%20stuff', -- cgit v1.2.3-54-g00ecf