Skip to content

Commit

Permalink
file name download should include MD5 from the contents of getCode #48
Browse files Browse the repository at this point in the history
  • Loading branch information
kchapple committed Dec 10, 2019
1 parent 192afb9 commit 5187b10
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ public function download( ZermeloRequest $request )
$reportGenerator = new ReportGenerator( $cache );
$collection = $reportGenerator->getCollection();

// File name download should include MD5 from the contents of getCode #48
if ($report->getCode()) {
$filename = $report->GetReportName() . '-'.$report->getCode().'.csv';
} else {
$filename = $report->GetReportName() . '.csv';
}

$response = new StreamedResponse( function() use ( $header, $collection ) {
// Open output stream
$handle = fopen('php://output', 'w');
Expand All @@ -65,7 +72,7 @@ public function download( ZermeloRequest $request )
}, 200, [
'Content-Description' => 'File Transfer',
'Content-Type' => 'text/csv',
'Content-Disposition' => 'attachment; filename="'.$report->GetReportName().'.csv"',
'Content-Disposition' => 'attachment; filename="'.$filename.'"',
'Content-Type' => 'application/octet-stream',
'Expires' => '0',
'Cache-Control' => 'must-revalidate',
Expand Down

0 comments on commit 5187b10

Please sign in to comment.