0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-01-03 13:21:51 +00:00

Use a more explicit URL regex to allow commas in a URL

This commit is contained in:
Travis Miller 2014-09-17 09:46:56 -05:00
parent cd60294ada
commit 726aa3e070

View File

@ -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();