Allow balanced round braces in URLs

beta
Vitaliy Filippov 2018-06-01 15:53:52 +03:00
parent 08c91c0007
commit 64341d027c
1 changed files with 4 additions and 7 deletions

View File

@ -289,15 +289,12 @@ sub quoteUrls
~gesix; ~gesix;
} }
$text =~ s~ # the protocol + non-whitespace + recursive braces + ending in [\w/~=)]
\b((?:$safe_protocols): # The protocol: $text =~ s/\b((?:$safe_protocols):([^\s<>\"\(\)]+|\((?2)*\))+(?<=[\w\/~=)]))/
[^\s<>\"]+ # Any non-whitespace
[\w\/]) # so that we end in \w or /
~
($tmp = html_quote($1)) && ($tmp = html_quote($1)) &&
($things[$count++] = "<a href=\"$tmp\">$tmp</a>") && ($things[$count++] = "<a href=\"$tmp\">$tmp<\/a>") &&
("\0\0" . ($count-1) . "\0\0") ("\0\0" . ($count-1) . "\0\0")
~gesox; /gesox;
if ($custom_proto && %$custom_proto) if ($custom_proto && %$custom_proto)
{ {