summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-23 03:28:11 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-23 03:28:11 +0200
commite11091837644b7d5c2ddbea657548ae222c2884b (patch)
tree74eaa45a5ddb1a8418124a5b5d0ce0870a5a9e2b
parentddb5db354ac1b55ce99c9d0e977a2a63099f4c21 (diff)
downloadbugzilla-e11091837644b7d5c2ddbea657548ae222c2884b.tar.gz
bugzilla-e11091837644b7d5c2ddbea657548ae222c2884b.tar.xz
Bug 556579: Back out the patch from bug 554819, because it caused special
characters in quoted strings to be interpreted instead of passed along. r=LpSolit, a=LpSolit
-rw-r--r--Bugzilla/Search/Quicksearch.pm36
1 files changed, 32 insertions, 4 deletions
diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm
index 1a2877674..df4383ef9 100644
--- a/Bugzilla/Search/Quicksearch.pm
+++ b/Bugzilla/Search/Quicksearch.pm
@@ -30,8 +30,6 @@ use Bugzilla::Status;
use Bugzilla::Field;
use Bugzilla::Util;
-use Text::ParseWords qw(quotewords);
-
use base qw(Exporter);
@Bugzilla::Search::Quicksearch::EXPORT = qw(quicksearch);
@@ -149,7 +147,7 @@ sub quicksearch {
$searchstring =~ s/\s+OR\s+/|/g;
$searchstring =~ s/\s+NOT\s+/ -/g;
- my @words = quotewords('\s+', 0, $searchstring);
+ my @words = splitString($searchstring);
_handle_status_and_resolution(\@words);
my (@unknownFields, %ambiguous_fields);
@@ -494,6 +492,36 @@ sub _handle_urls {
# Helpers
###########################################################################
+# Split string on whitespace, retaining quoted strings as one
+sub splitString {
+ my $string = shift;
+ my @quoteparts;
+ my @parts;
+ my $i = 0;
+
+ # Now split on quote sign; be tolerant about unclosed quotes
+ @quoteparts = split(/"/, $string);
+ foreach my $part (@quoteparts) {
+ # After every odd quote, quote special chars
+ $part = url_quote($part) if $i++ % 2;
+ }
+ # Join again
+ $string = join('"', @quoteparts);
+
+ # Now split on unescaped whitespace
+ @parts = split(/\s+/, $string);
+ foreach (@parts) {
+ # Protect plus signs from becoming a blank.
+ # If "+" appears as the first character, leave it alone
+ # as it has a special meaning. Strings which start with
+ # "+" must be quoted.
+ s/(?<!^)\+/%2B/g;
+ # Remove quotes
+ s/"//g;
+ }
+ return @parts;
+}
+
# Expand found prefixes to states or resolutions
sub matchPrefixes {
my $hr_states = shift;
@@ -552,7 +580,7 @@ sub makeChart {
my $cgi = Bugzilla->cgi;
$cgi->param("field$expr", $field);
$cgi->param("type$expr", $type);
- $cgi->param("value$expr", $value);
+ $cgi->param("value$expr", url_decode($value));
}
1;