Skip to content

Commit

Permalink
Fixed LFI in custom report csv download
Browse files Browse the repository at this point in the history
  • Loading branch information
brusch committed Feb 5, 2021
1 parent 3224684 commit 1786bdd
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public function createCsvAction(Request $request)
$progress = $progress > 1 ? 1 : $progress;

return new JsonResponse([
'exportFile' => $exportFile,
'exportFile' => basename($exportFile),
'offset' => $offset,
'progress' => $progress,
'finished' => empty($result['data']) || count($result['data']) < $limit,
Expand All @@ -451,6 +451,7 @@ public function downloadCsvAction(Request $request)
{
$this->checkPermission('reports');
if ($exportFile = $request->get('exportFile')) {
$exportFile = PIMCORE_SYSTEM_TEMP_DIRECTORY . '/' . basename($exportFile);
$response = new BinaryFileResponse($exportFile);
$response->headers->set('Content-Type', 'text/csv; charset=UTF-8');
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'export.csv');
Expand Down

0 comments on commit 1786bdd

Please sign in to comment.