From fef7af0306e6c1c90e4ed16e2594fa393d0ff339 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" Date: Mon, 25 May 2009 16:59:23 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20494369:=20Do=20not=20throw=20an=20error?= =?UTF-8?q?=20if=20the=20'order'=20parameter=20contains=20invalid=20column?= =?UTF-8?q?s=20for=20buglists=20-=20Patch=20by=20Fr=C3=83=C2=A9d=C3=83?= =?UTF-8?q?=C2=A9ric=20Buclin=20=20r=3Dwicked=20a=3DLpS?= =?UTF-8?q?olit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.0.0.236/trunk@257283 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/buglist.cgi | 19 +++++++------------ .../en/default/global/code-error.html.tmpl | 11 ----------- .../en/default/global/messages.html.tmpl | 5 +++++ 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/mozilla/webtools/bugzilla/buglist.cgi b/mozilla/webtools/bugzilla/buglist.cgi index 2cf7a013661..2eee0edd990 100755 --- a/mozilla/webtools/bugzilla/buglist.cgi +++ b/mozilla/webtools/bugzilla/buglist.cgi @@ -165,7 +165,6 @@ my $serverpush = || $cgi->param('serverpush'); my $order = $cgi->param('order') || ""; -my $order_from_cookie = 0; # True if $order set using the LASTORDER cookie # The params object to use for the actual query itself my $params; @@ -890,8 +889,6 @@ if (!$order || $order =~ /^reuse/i) { # Cookies from early versions of Specific Search included this text, # which is now invalid. $order =~ s/ LIMIT 200//; - - $order_from_cookie = 1; } else { $order = ''; # Remove possible "reuse" identifier as unnecessary @@ -920,7 +917,7 @@ if ($order) { last ORDER; }; do { - my @order; + my (@order, @invalid_fragments); my @columnnames = map($columns->{lc($_)}->{'name'}, keys(%$columns)); # A custom list of columns. Make sure each column is valid. foreach my $fragment (split(/,/, $order)) { @@ -933,16 +930,14 @@ if ($order) { push(@order, $fragment); } else { - my $vars = { fragment => $fragment }; - if ($order_from_cookie) { - $cgi->remove_cookie('LASTORDER'); - ThrowCodeError("invalid_column_name_cookie", $vars); - } - else { - ThrowCodeError("invalid_column_name_form", $vars); - } + push(@invalid_fragments, $fragment); } } + if (scalar @invalid_fragments) { + $vars->{'message'} = 'invalid_column_name'; + $vars->{'invalid_fragments'} = \@invalid_fragments; + } + $order = join(",", @order); # Now that we have checked that all columns in the order are valid, # detaint the order string. diff --git a/mozilla/webtools/bugzilla/template/en/default/global/code-error.html.tmpl b/mozilla/webtools/bugzilla/template/en/default/global/code-error.html.tmpl index a2863336a12..da71da30dbc 100644 --- a/mozilla/webtools/bugzilla/template/en/default/global/code-error.html.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/global/code-error.html.tmpl @@ -190,17 +190,6 @@ The attachment number of one of the attachments you wanted to obsolete, [% attach_id FILTER html %], is invalid. - [% ELSIF error == "invalid_column_name_cookie" %] - [% title = "Invalid Column Name" %] - The custom sort order specified in your cookie contains an invalid - column name [% fragment FILTER html %]. - The cookie has been cleared. - - [% ELSIF error == "invalid_column_name_form" %] - [% title = "Invalid Column Name" %] - The custom sort order specified in your form submission contains an - invalid column name [% fragment FILTER html %]. - [% ELSIF error == "invalid_customfield_type" %] [% title = "Invalid Field Type" %] The type [% type FILTER html %] is not a valid field type. diff --git a/mozilla/webtools/bugzilla/template/en/default/global/messages.html.tmpl b/mozilla/webtools/bugzilla/template/en/default/global/messages.html.tmpl index d2915780cfa..1bc10daa95a 100644 --- a/mozilla/webtools/bugzilla/template/en/default/global/messages.html.tmpl +++ b/mozilla/webtools/bugzilla/template/en/default/global/messages.html.tmpl @@ -455,6 +455,11 @@ group. [% END %] + [% ELSIF message_tag == "invalid_column_name" %] + The custom sort order specified contains one or more invalid + column names: [% invalid_fragments.join(', ') FILTER html %]. + They have been removed from the sort list. + [% ELSIF message_tag == "job_queue_depth" %] [% count FILTER html %] jobs in the queue.