From b9ad8b310f7a45317299161c19b529af326b1193 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 25 Jun 2024 21:43:22 +0000 Subject: [PATCH] Bug 23685: Don't store ODS content in a variable to save memory Content-Type: text/plain; charset=utf-8 Just attaching this to start. Sponsored-by: Waikato Institute of Technology Signed-off-by: Marcel de Rooy --- reports/guided_reports.pl | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index 236e43c8e5..1464afa929 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -684,7 +684,11 @@ elsif ($op eq 'export'){ # Output binmode(STDOUT); open $ods_fh, '<', $ods_filepath; - $content .= $_ while <$ods_fh>; + print $input->header( + -type => $type, + -attachment => $reportfilename + ); + print $_ while <$ods_fh>; unlink $ods_filepath; } elsif ( $format eq 'template' ) { @@ -708,11 +712,14 @@ elsif ($op eq 'export'){ ); } } - print $input->header( - -type => $type, - -attachment=> $reportfilename - ); - print $content; + + unless ( $format eq 'ods' ) { + print $input->header( + -type => $type, + -attachment => $reportfilename + ); + print $content; + } foreach my $err (@$q_errors, @errors) { print "# ERROR: " . (map {$_ . ": " . $err->{$_}} keys %$err) . "\n"; -- 2.30.2