]> git.donarmstrong.com Git - debbugs.git/blobdiff - cgi/pkgreport.cgi
properly handle orderings in pkgreport.cgi
[debbugs.git] / cgi / pkgreport.cgi
index 4f4ea800af986fcd38f0c58ba04dd8e121a41a95..e5a4b992ef3f0946e8260fa19fd2bfbc24f70051 100755 (executable)
@@ -18,7 +18,9 @@ BEGIN{
     delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
 }
 
+binmode(STDOUT,':encoding(UTF-8)');
 use POSIX qw(strftime nice);
+use List::Util qw(uniq);
 
 use Debbugs::Config qw(:globals :text :config);
 
@@ -274,7 +276,8 @@ if (defined $param{usertag}) {
      }
 }
 
-quitcgi("You have to choose something to select by") unless grep {exists $param{$_}} keys %package_search_keys;
+quitcgi("You have to choose something to select by", '400 Bad Request')
+  unless grep {exists $param{$_}} keys %package_search_keys;
 
 
 my $Archived = $param{archive} ? " Archived" : "";
@@ -435,6 +438,7 @@ my $result = pkg_htmlizebugs(bugs => \@bugs,
                             (exists $param{dist})?(dist    => $param{dist}):(),
                            );
 
+print "Cache-Control: public, max-age=300\n";
 print "Content-Type: text/html; charset=utf-8\n\n";
 
 print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
@@ -492,6 +496,9 @@ print fill_in_template(template=>'cgi/pkgreport_javascript');
 
 print qq(<h2 class="outstanding"><!--<a class="options" href="javascript:toggle(1)">-->Options<!--</a>--></h2>\n);
 
+$param{orderings} =
+    [uniq((grep {!$hidden{$_}} keys %cats),
+         $param{ordering})];
 print option_form(template => 'cgi/pkgreport_options',
                  param    => \%param,
                  form_options => $form_options,