fix: avoid invalid filename when generating ics download

This commit is contained in:
Björn Fromme
2024-10-28 17:40:08 +01:00
parent d26a1840d1
commit 3aad618eea
@@ -11,6 +11,7 @@ use Symfony\Component\HttpFoundation\HeaderUtils;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\String\Slugger\AsciiSlugger;
class IcsController extends AbstractController class IcsController extends AbstractController
{ {
@@ -36,7 +37,13 @@ class IcsController extends AbstractController
$assignment->getEffectivePeriod()->start->format('d.m.Y'), $assignment->getEffectivePeriod()->start->format('d.m.Y'),
$assignment->getEffectivePeriod()->end->format('d.m.Y') $assignment->getEffectivePeriod()->end->format('d.m.Y')
); );
$contentDisposition = HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_INLINE, $filename, md5($filename)); $slugger = new AsciiSlugger();
$filename = $slugger->slug($filename);
$contentDisposition = HeaderUtils::makeDisposition(
HeaderUtils::DISPOSITION_INLINE,
$filename,
md5($filename)
);
$response = new Response($ics); $response = new Response($ics);
$response->setPrivate(); $response->setPrivate();