Make sure to clean the response before returning files

Was a problemw when returning images and there were leading empty lines in config.php which seem to get added to the response always...
This commit is contained in:
Bernd Bestel
2021-07-12 15:34:26 +02:00
parent 6659a5cd08
commit 2cc4f4d382
2 changed files with 3 additions and 0 deletions

View File

@@ -49,6 +49,7 @@ class CalendarApiController extends BaseApiController
$vCalendar->addEvent($vEvent);
}
ob_clean(); // Make sure to ONLY return the file
$response->write((new CalendarFactory())->createCalendar($vCalendar));
$response = $response->withHeader('Content-Type', 'text/calendar; charset=utf-8');
return $response->withHeader('Content-Disposition', 'attachment; filename="grocy.ics"');