From 64341d027c1cc55ebaad34549aa44a90471486de Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Fri, 1 Jun 2018 15:53:52 +0300 Subject: [PATCH] Allow balanced round braces in URLs --- Bugzilla/Template.pm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 6834dd267..2555e2144 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -289,15 +289,12 @@ sub quoteUrls ~gesix; } - $text =~ s~ - \b((?:$safe_protocols): # The protocol: - [^\s<>\"]+ # Any non-whitespace - [\w\/]) # so that we end in \w or / - ~ + # the protocol + non-whitespace + recursive braces + ending in [\w/~=)] + $text =~ s/\b((?:$safe_protocols):([^\s<>\"\(\)]+|\((?2)*\))+(?<=[\w\/~=)]))/ ($tmp = html_quote($1)) && - ($things[$count++] = "$tmp") && + ($things[$count++] = "$tmp<\/a>") && ("\0\0" . ($count-1) . "\0\0") - ~gesox; + /gesox; if ($custom_proto && %$custom_proto) {