From 226fffec6fd0154ea8798b58321d4d119341879f Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 27 Nov 2012 21:43:37 -0800 Subject: [PATCH] remove trailing junk from XLSX files, #20337 --- httemplate/graph/elements/report.html | 4 ++-- httemplate/search/customer_accounting_summary.html | 6 ++++-- httemplate/search/elements/search-xls.html | 2 +- httemplate/search/elements/search.html | 4 +++- httemplate/search/report_tax-xls.cgi | 3 ++- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/httemplate/graph/elements/report.html b/httemplate/graph/elements/report.html index 98b477826..b7073db31 100644 --- a/httemplate/graph/elements/report.html +++ b/httemplate/graph/elements/report.html @@ -126,8 +126,8 @@ any delimiter and linked from the elements in @data. % $workbook->close();# or die "Error creating .xls file: $!"; % % http_header('Content-Length' => length($output) ); -% -<% $output %> +% $m->print($output); +% % } elsif ( $cgi->param('_type') eq 'png' ) { % # delete any items that shouldn't be on the graph % if ( my $no_graph = $opt{'no_graph'} ) { diff --git a/httemplate/search/customer_accounting_summary.html b/httemplate/search/customer_accounting_summary.html index 5ce2e3a8f..557528325 100644 --- a/httemplate/search/customer_accounting_summary.html +++ b/httemplate/search/customer_accounting_summary.html @@ -73,9 +73,11 @@ $r++; } #$row $workbook->close; + + http_header('Content-Length' => length($output)); + $m->print($output); -<% $output %> -% } else { +% } else { <& /elements/header.html, $title &> % my $myself = $cgi->self_url;

diff --git a/httemplate/search/elements/search-xls.html b/httemplate/search/elements/search-xls.html index 94d88b096..26a51c4c7 100644 --- a/httemplate/search/elements/search-xls.html +++ b/httemplate/search/elements/search-xls.html @@ -1,4 +1,3 @@ -<% $data %> <%init> my %args = @_; @@ -148,5 +147,6 @@ if ( $opt{'footer'} ) { $workbook->close();# or die "Error creating .xls file: $!"; http_header('Content-Length' => length($data) ); +$m->print($data); diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index eca68a2f8..5a16a22fe 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -176,7 +176,9 @@ Example: % % } elsif ( $type =~ /\.xls$/ ) { % -<% include('search-xls.html', header=>$header, rows=>$rows, opt=>\%opt ) %> +<& 'search-xls.html', header=>$header, rows=>$rows, opt=>\%opt &>\ +% # prevent the caller from polluting our output stream +% $m->abort; % % } elsif ( $type eq 'xml' ) { % diff --git a/httemplate/search/report_tax-xls.cgi b/httemplate/search/report_tax-xls.cgi index f19f85aaa..bb843a73f 100755 --- a/httemplate/search/report_tax-xls.cgi +++ b/httemplate/search/report_tax-xls.cgi @@ -1,4 +1,3 @@ -<% $data %> <%init> my $htmldoc = include('report_tax.cgi'); @@ -155,4 +154,6 @@ for my $x (0..scalar(@widths)-1) { $workbook->close; +http_header('Content-Length' => length($data)); +$m->print($data); -- 2.11.0