From 268bc33484b25003db28f659d14328798e8830e4 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Sat, 29 Sep 2012 13:47:13 +0200 Subject: Bug 793893: Tabular reports crash when no format parameter is defined r=glob a=LpSolit --- report.cgi | 9 ++++----- template/en/default/filterexceptions.pl | 1 - template/en/default/reports/report.html.tmpl | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/report.cgi b/report.cgi index 1ec3ac864..4230ade36 100755 --- a/report.cgi +++ b/report.cgi @@ -84,10 +84,12 @@ if (defined($height)) { $height <= 2000 || ThrowUserError("chart_too_large"); } +my $formatparam = $cgi->param('format') || ''; + # These shenanigans are necessary to make sure that both vertical and # horizontal 1D tables convert to the correct dimension when you ask to # display them as some sort of chart. -if (defined $cgi->param('format') && $cgi->param('format') eq "table") { +if ($formatparam eq "table") { if ($col_field && !$row_field) { # 1D *tables* should be displayed vertically (with a row_field only) $row_field = $col_field; @@ -210,7 +212,7 @@ $vars->{'row_names'} = \@row_names; $vars->{'tbl_names'} = \@tbl_names; # Below a certain width, we don't see any bars, so there needs to be a minimum. -if ($width && $cgi->param('format') eq "bar") { +if ($width && $formatparam eq "bar") { my $min_width = (scalar(@col_names) || 1) * 20; if (!$cgi->param('cumulate')) { @@ -226,8 +228,6 @@ $vars->{'height'} = $height if $height; $vars->{'query'} = $query; $vars->{'debug'} = $cgi->param('debug'); -my $formatparam = $cgi->param('format'); - if ($action eq "wrap") { # So which template are we using? If action is "wrap", we will be using # no format (it gets passed through to be the format of the actual data), @@ -236,7 +236,6 @@ if ($action eq "wrap") { # data, or images generated by calling report.cgi again with action as # "plot". $formatparam =~ s/[^a-zA-Z\-]//g; - trick_taint($formatparam); $vars->{'format'} = $formatparam; $formatparam = ''; diff --git a/template/en/default/filterexceptions.pl b/template/en/default/filterexceptions.pl index 3e2a71e2c..d804ad8fa 100644 --- a/template/en/default/filterexceptions.pl +++ b/template/en/default/filterexceptions.pl @@ -106,7 +106,6 @@ 'other_format.name', 'sizeurl', 'switchbase', - 'format', 'cumulate', ], diff --git a/template/en/default/reports/report.html.tmpl b/template/en/default/reports/report.html.tmpl index d4c9d4043..94725ae81 100644 --- a/template/en/default/reports/report.html.tmpl +++ b/template/en/default/reports/report.html.tmpl @@ -170,7 +170,7 @@ this report [% ELSE %] + [% format FILTER uri %]&format=report-graph&cumulate=[% cumulate %]"> Edit this report [% END %] -- cgit v1.2.3-24-g4f1b