Skip to content

symfony/mime csv mime type with php 8 #39237

Closed
@cappuc

Description

@cappuc

Symfony version(s) affected: 5.*

Description
With php 8 finfo returns application/csv as mime type for csv files and this mime type is not supported in guessExtension so it returns null.
With php 7.4 csv files are recognized as text/plain and the guessed extension is txt.

How to reproduce
Try with php 8:

$mime = MimeTypes::getDefault()->guessMimeType('path/to/csv_file.csv');
$extension = MimeTypes::getDefault()->getExtensions($mime);
echo $mime;
echo $extension;

Possible Solution
Add 'application/csv' => ['csv'] to MimeTypes extensions map

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions