diff --git a/src/app/Services/JasperServerRequestService.php b/src/app/Services/JasperServerRequestService.php index e60b11f..62ecb89 100644 --- a/src/app/Services/JasperServerRequestService.php +++ b/src/app/Services/JasperServerRequestService.php @@ -261,9 +261,11 @@ class JasperServerRequestService implements JasperServerRequestServiceContract private function setHeader(string $report, ?string $filename = null) { if (!$filename) { - $filename = uniqid() . '.' . $this->format; + $filename = uniqid(); } + $filename = $this->appendFormatExtension($filename); + header('Cache-Control: must-revalidate'); header('Pragma: public'); header('Content-Description: File Transfer'); @@ -272,4 +274,13 @@ class JasperServerRequestService implements JasperServerRequestServiceContract header('Content-Length: ' . strlen($report)); header('Content-Type: ' . ReportFormatEnum::getMimeType($this->format)); } + + /** + * @param string $filename + * @return string + */ + private function appendFormatExtension(string $filename): string + { + return $filename . '.' . $this->format; + } }