From: lpsolit%gmail.com <> Date: Sun, 19 Jul 2009 12:03:35 +0000 (+0000) Subject: Bug 503821: Link in "Delete Tag?" user error triggers "Suspicious action" prompt... X-Git-Tag: bugzilla-3.2.5~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2c31d0cf347f468696918da646e1d8c92a850e19;p=thirdparty%2Fbugzilla.git Bug 503821: Link in "Delete Tag?" user error triggers "Suspicious action" prompt - Patch by Frédéric Buclin r=wicked a=LpSolit --- diff --git a/buglist.cgi b/buglist.cgi index a487759015..294b8d1535 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -566,7 +566,10 @@ elsif (($cgi->param('cmdtype') eq "doit") && defined $cgi->param('remtype')) { # exists, add/remove bugs to it, else create it. But if we are # considering an existing tag, then it has to exist and we throw # an error if it doesn't (hence the usage of !$is_new_name). - if (my $old_query = LookupNamedQuery($query_name, undef, LIST_OF_BUGS, !$is_new_name)) { + my ($old_query, $query_id) = + LookupNamedQuery($query_name, undef, LIST_OF_BUGS, !$is_new_name); + + if ($old_query) { # We get the encoded query. We need to decode it. my $old_cgi = new Bugzilla::CGI($old_query); foreach my $bug_id (split /[\s,]+/, scalar $old_cgi->param('bug_id')) { @@ -590,9 +593,10 @@ elsif (($cgi->param('cmdtype') eq "doit") && defined $cgi->param('remtype')) { # Only keep bug IDs we want to add/keep. Disregard deleted ones. my @bug_ids = grep { $bug_ids{$_} == 1 } keys %bug_ids; # If the list is now empty, we could as well delete it completely. - ThrowUserError('no_bugs_in_list', {'tag' => $query_name}) - unless scalar(@bug_ids); - + if (!scalar @bug_ids) { + ThrowUserError('no_bugs_in_list', {name => $query_name, + query_id => $query_id}); + } $new_query = "bug_id=" . join(',', sort {$a <=> $b} @bug_ids); $query_type = LIST_OF_BUGS; } diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index bbae9b39cd..1c834d47af 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -1101,9 +1101,11 @@ [% ELSIF error == "no_bugs_in_list" %] [% title = "Delete Tag?" %] This will remove all [% terms.bugs %] from the - [% tag FILTER html %] tag. This will delete the tag completely. Click + [% name FILTER html %] tag. This will delete the tag completely. Click here if you really want to delete it. + [%- name FILTER url_quote %]&token= + [%- issue_hash_token([query_id, name]) FILTER url_quote %]">here + if you really want to delete it. [% ELSIF error == "no_bugs_to_remove" %] [% title = "No Tag Selected" %]