From c76992450510f2d6261bc7c4380151681b7d5c06 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 9 Mar 2016 15:05:36 +0100 Subject: [PATCH] Reduce the number of allowed characters in auto-linking URLs. --- lib/framework.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/framework.php b/lib/framework.php index 3a62bb5d68..5017fc01ea 100644 --- a/lib/framework.php +++ b/lib/framework.php @@ -57,9 +57,14 @@ define('NOTICE_INBOX_SOURCE_FORWARD', 4); define('NOTICE_INBOX_SOURCE_PROFILE_TAG', 5); define('NOTICE_INBOX_SOURCE_GATEWAY', -1); -define('URL_REGEX_VALID_PATH_CHARS', '\pN\pL\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\@'); -define('URL_REGEX_VALID_QSTRING_CHARS', URL_REGEX_VALID_PATH_CHARS); -define('URL_REGEX_VALID_FRAGMENT_CHARS', URL_REGEX_VALID_PATH_CHARS . '\?\#'); +/** + * StatusNet had this string as valid path characters: '\pN\pL\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\'\@' + * Some of those characters can be troublesome when auto-linking plain text. Such as "http://some.com/)" + * URL encoding should be used whenever a weird character is used, the following strings are not definitive. + */ +define('URL_REGEX_VALID_PATH_CHARS', '\pN\pL\,\-\_\+\/\=\:\;\%\~\*'); +define('URL_REGEX_VALID_QSTRING_CHARS', URL_REGEX_VALID_PATH_CHARS . '\&'); +define('URL_REGEX_VALID_FRAGMENT_CHARS', URL_REGEX_VALID_QSTRING_CHARS . '\?\#'); // append our extlib dir as the last-resort place to find libs -- 2.39.5