From 726aa3e0703a89f2313426c59ecc47fa967d61be Mon Sep 17 00:00:00 2001 From: Travis Miller Date: Wed, 17 Sep 2014 09:46:56 -0500 Subject: [PATCH] Use a more explicit URL regex to allow commas in a URL --- library/HTMLPurifier/Injector/Linkify.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/HTMLPurifier/Injector/Linkify.php b/library/HTMLPurifier/Injector/Linkify.php index 069708c2..b87b5b9b 100644 --- a/library/HTMLPurifier/Injector/Linkify.php +++ b/library/HTMLPurifier/Injector/Linkify.php @@ -33,7 +33,8 @@ class HTMLPurifier_Injector_Linkify extends HTMLPurifier_Injector // there is/are URL(s). Let's split the string: // Note: this regex is extremely permissive - $bits = preg_split('#((?:https?|ftp)://[^\s\'",<>()]+)#Su', $token->data, -1, PREG_SPLIT_DELIM_CAPTURE); + // $bits = preg_split('#((?:https?|ftp)://[^\s\'",<>()]+)#Su', $token->data, -1, PREG_SPLIT_DELIM_CAPTURE); + $bits = preg_split('#((?:https?|ftp)://\S+(?!(?<=[,\'")}>\]])\s?))#Su', $token->data, -1, PREG_SPLIT_DELIM_CAPTURE); $token = array();