diff options
author | Dylan William Hardison <dylan@hardison.net> | 2017-03-07 19:15:53 +0100 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2017-03-07 23:52:13 +0100 |
commit | d1cf67fc2271981260e919795706ee051a3279c9 (patch) | |
tree | 1d2f336d9cc22c7cf132e4fd45304b3f235bcf62 /Bugzilla/Util.pm | |
parent | 9c26c01867ca3e2af1e70c051140eea59c68c500 (diff) | |
download | bugzilla-d1cf67fc2271981260e919795706ee051a3279c9.tar.gz bugzilla-d1cf67fc2271981260e919795706ee051a3279c9.tar.xz |
Bug 1345181 - Improve performance of html_quote()
Diffstat (limited to 'Bugzilla/Util.pm')
-rw-r--r-- | Bugzilla/Util.pm | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm index fd0f8b92e..4371441a0 100644 --- a/Bugzilla/Util.pm +++ b/Bugzilla/Util.pm @@ -65,17 +65,20 @@ sub detaint_signed { return (defined($_[0])); } +my %html_quote = ( + q{&} => '&', + q{<} => '<', + q{>} => '>', + q{"} => '"', + q{@} => '@', # Obscure '@'. +); + # Bug 120030: Override html filter to obscure the '@' in user # visible strings. # Bug 319331: Handle BiDi disruptions. sub html_quote { my $var = shift; - $var =~ s/&/&/g; - $var =~ s/</</g; - $var =~ s/>/>/g; - $var =~ s/"/"/g; - # Obscure '@'. - $var =~ s/\@/\@/g; + $var =~ s/([&<>"@])/$html_quote{$1}/g; state $use_utf8 = Bugzilla->params->{'utf8'}; |