fix: avoid invalid filename when generating ics download
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user