From 55356e523e5df8782b5ea76560fc49bdfe4c10ac Mon Sep 17 00:00:00 2001 From: Fabricio872 Date: Thu, 7 Nov 2024 15:15:16 +0100 Subject: [PATCH] fixed file name encoding (#18) --- src/Controller/Api/DownloadController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Controller/Api/DownloadController.php b/src/Controller/Api/DownloadController.php index 3942b71..29de505 100644 --- a/src/Controller/Api/DownloadController.php +++ b/src/Controller/Api/DownloadController.php @@ -51,7 +51,7 @@ public function bootstrap53(DownloadTypeEnum $identifier, #[MapRequestPayload(se content: $this->findBuilder($identifier)->build($bootstrap53Dto), headers: [ 'Content-Type' => $identifier->getType()->getMimeType(), - 'Content-Disposition' => 'attachment; filename="' . $identifier->getType()->getFileName() . '"' + 'Content-Disposition' => 'attachment; filename="' . rawurlencode($identifier->getType()->getFileName()) . '"', ] ); } @@ -59,7 +59,7 @@ public function bootstrap53(DownloadTypeEnum $identifier, #[MapRequestPayload(se private function findBuilder(DownloadTypeEnum $identifier): ?FileBuilderInterface { return (new ArrayCollection(iterator_to_array($this->fileBuilders)))->findFirst( - fn(int $key, FileBuilderInterface $fileBuilder):bool => $fileBuilder instanceof ($identifier->getType()->getBuilderFqn()) + fn(int $key, FileBuilderInterface $fileBuilder): bool => $fileBuilder instanceof ($identifier->getType()->getBuilderFqn()) ); } } \ No newline at end of file