]> git.agnieray.net Git - galette.git/commitdiff
Fix contributions PDF content type; refs #1271
authorJohan Cwiklinski <jcwiklinski@teclib.com>
Sat, 16 Nov 2019 18:46:47 +0000 (19:46 +0100)
committerJohan Cwiklinski <jcwiklinski@teclib.com>
Sat, 16 Nov 2019 18:46:47 +0000 (19:46 +0100)
galette/includes/routes/contributions.routes.php

index fa802e4a05310030a7e57f495445ca285165f33c..6d419c2d3a0d8cbef9f4e7f6227a53c82341b5b8 100644 (file)
@@ -1254,6 +1254,10 @@ $app->get(
     function ($request, $response, $args) {
         $contribution = new Contribution($this->zdb, $this->login, (int)$args['id']);
         $pdf = new PdfContribution($contribution, $this->zdb, $this->preferences);
-        $pdf->download();
+
+        $response = $this->response->withHeader('Content-type', 'application/pdf')
+                ->withHeader('Content-Disposition', 'attachment;filename="' . $pdf->getFileName() . '"');
+        $response->write($pdf->download());
+        return $response;
     }
 )->setName('printContribution')->add($authenticate);