Skip to content

Commit

Permalink
fixed file name encoding (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabricio872 authored Nov 7, 2024
1 parent 9786a6b commit 55356e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Controller/Api/DownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ 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()) . '"',
]
);
}

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())
);
}
}

0 comments on commit 55356e5

Please sign in to comment.