bug #39252 [Mime] Leverage PHP 8's detection of CSV files (derrabus)
This PR was merged into the 4.4 branch.
Discussion
----------
[Mime] Leverage PHP 8's detection of CSV files
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | #39237
| License | MIT
| Doc PR | N/A
Commits
-------
41a965cdc4
[Mime] Leverage PHP 8's detection of CSV files.
This commit is contained in:
commit
4a2946b46d
@ -166,6 +166,7 @@ final class MimeTypes implements MimeTypesInterface
|
|||||||
'application/cdmi-queue' => ['cdmiq'],
|
'application/cdmi-queue' => ['cdmiq'],
|
||||||
'application/cdr' => ['cdr'],
|
'application/cdr' => ['cdr'],
|
||||||
'application/coreldraw' => ['cdr'],
|
'application/coreldraw' => ['cdr'],
|
||||||
|
'application/csv' => ['csv'],
|
||||||
'application/cu-seeme' => ['cu'],
|
'application/cu-seeme' => ['cu'],
|
||||||
'application/davmount+xml' => ['davmount'],
|
'application/davmount+xml' => ['davmount'],
|
||||||
'application/dbase' => ['dbf'],
|
'application/dbase' => ['dbf'],
|
||||||
@ -1817,7 +1818,7 @@ final class MimeTypes implements MimeTypesInterface
|
|||||||
'csp' => ['application/vnd.commonspace'],
|
'csp' => ['application/vnd.commonspace'],
|
||||||
'css' => ['text/css'],
|
'css' => ['text/css'],
|
||||||
'cst' => ['application/x-director'],
|
'cst' => ['application/x-director'],
|
||||||
'csv' => ['text/csv', 'text/x-comma-separated-values', 'text/x-csv'],
|
'csv' => ['text/csv', 'text/x-comma-separated-values', 'text/x-csv', 'application/csv'],
|
||||||
'csvs' => ['text/csv-schema'],
|
'csvs' => ['text/csv-schema'],
|
||||||
'cu' => ['application/cu-seeme'],
|
'cu' => ['application/cu-seeme'],
|
||||||
'cue' => ['application/x-cue'],
|
'cue' => ['application/x-cue'],
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
a,b,c
|
||||||
|
d,e,f
|
||||||
|
g,h,i
|
|
@ -73,4 +73,18 @@ class MimeTypesTest extends AbstractMimeTypeGuesserTest
|
|||||||
$this->assertContains('text/baz', $mt->getMimeTypes('foo'));
|
$this->assertContains('text/baz', $mt->getMimeTypes('foo'));
|
||||||
$this->assertSame(['foo', 'moof'], $mt->getExtensions('text/baz'));
|
$this->assertSame(['foo', 'moof'], $mt->getExtensions('text/baz'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP 8 detects .csv files as "application/csv" while PHP 7 returns "text/plain".
|
||||||
|
*
|
||||||
|
* @requires PHP 8
|
||||||
|
*/
|
||||||
|
public function testCsvExtension()
|
||||||
|
{
|
||||||
|
$mt = new MimeTypes();
|
||||||
|
|
||||||
|
$mime = $mt->guessMimeType(__DIR__.'/Fixtures/mimetypes/abc.csv');
|
||||||
|
$this->assertSame('application/csv', $mime);
|
||||||
|
$this->assertSame(['csv'], $mt->getExtensions($mime));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user