Commit 604ccd0d authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 366120: QuickSearch gets confused by colons in quotes - Patch by Teemu…

Bug 366120: QuickSearch gets confused by colons in quotes - Patch by Teemu Mannermaa <wicked+bz@etlicon.fi> r/a=LpSolit
parent 75608afd
...@@ -410,28 +410,22 @@ sub splitString { ...@@ -410,28 +410,22 @@ sub splitString {
my @parts; my @parts;
my $i = 0; my $i = 0;
# Escape backslashes
$string =~ s/\\/\\\//g;
# Now split on quote sign; be tolerant about unclosed quotes # Now split on quote sign; be tolerant about unclosed quotes
@quoteparts = split(/"/, $string); @quoteparts = split(/"/, $string);
foreach (@quoteparts) { foreach my $part (@quoteparts) {
# After every odd quote, escape whitespace # After every odd quote, quote special chars
s/(\s)/\\$1/g if $i++ % 2; $part = url_quote($part) if $i++ % 2;
} }
# Join again # Join again
$string = join('"', @quoteparts); $string = join('"', @quoteparts);
# Now split on unescaped whitespace # Now split on unescaped whitespace
@parts = split(/(?<!\\)\s+/, $string); @parts = split(/\s+/, $string);
foreach (@parts) { foreach (@parts) {
# Restore whitespace
s/\\(\s)/$1/g;
# Restore backslashes
s/\\\//\\/g;
# Remove quotes # Remove quotes
s/"//g; s/"//g;
} }
return @parts; return @parts;
} }
...@@ -502,7 +496,7 @@ sub makeChart { ...@@ -502,7 +496,7 @@ sub makeChart {
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
$cgi->param("field$expr", $field); $cgi->param("field$expr", $field);
$cgi->param("type$expr", $type); $cgi->param("type$expr", $type);
$cgi->param("value$expr", $value); $cgi->param("value$expr", url_decode($value));
} }
1; 1;
...@@ -34,7 +34,7 @@ use base qw(Exporter); ...@@ -34,7 +34,7 @@ use base qw(Exporter);
@Bugzilla::Util::EXPORT = qw(is_tainted trick_taint detaint_natural @Bugzilla::Util::EXPORT = qw(is_tainted trick_taint detaint_natural
detaint_signed detaint_signed
html_quote url_quote value_quote xml_quote html_quote url_quote value_quote xml_quote
css_class_quote html_light_quote css_class_quote html_light_quote url_decode
i_am_cgi get_netaddr correct_urlbase i_am_cgi get_netaddr correct_urlbase
lsearch lsearch
diff_arrays diff_strings diff_arrays diff_strings
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment