Closed math-GH closed 4 years ago
Contao Leads uses \Contao\File
to send the file to the browser, which does not set a Content-Type
response header on its own. And somewhere down the pipeline either Contao or Symfony adds the Content-Type: text/plain
header.
\Contao\File::sendToBrowser
is missing the following:
$response->headers->set('Content-Type', $this->getMimeType());
If the Content-Type
header is missing, Response::prepare
in Symfony's ResponseListener
will automatically add it via the FileinfoMimeTypeGuesser
which uses PHP Fileinfo. And fileinfo will guess the mime type according to the content of the file, which is just plain text in case of a CSV …
Should be fixed in the next Contao versions. See https://github.com/contao/contao/pull/2020
Contao 4.9.3 Leads 1.4.18
I want to export CSV files
But I get .txt as file extension