From: David Lawrence Date: Mon, 25 Jul 2011 05:29:43 +0000 (-0400) Subject: Bug 652663 - When using bug_format_comment hook some replacements can happen more... X-Git-Tag: bugzilla-4.0.2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b904b58121032c65b8c5bd2d14fece880036e6b;p=thirdparty%2Fbugzilla.git Bug 652663 - When using bug_format_comment hook some replacements can happen more than once causing broken links r/a=LpSolit --- diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index f58128eec0..4320121bfb 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -257,8 +257,10 @@ sub quoteUrls { ~get_bug_link($1, $1) ~egmx; - # Now remove the encoding hacks - $text =~ s/\0\0(\d+)\0\0/$things[$1]/eg; + # Now remove the encoding hacks in reverse order + for (my $i = $#things; $i >= 0; $i--) { + $text =~ s/\0\0($i)\0\0/$things[$i]/eg; + } $text =~ s/$chr1\0/\0/g; return $text;