Merge pull request #4449 from stweil/mimetypes
Add mimetypes for jp2 and webp
This commit is contained in:
commit
d4329f3355
3 changed files with 36 additions and 0 deletions
|
@ -110,6 +110,15 @@ class RepairMimeTypes implements IRepairStep {
|
|||
}
|
||||
}
|
||||
|
||||
private function introduceImageTypes() {
|
||||
$updatedMimetypes = array(
|
||||
'jp2' => 'image/jp2',
|
||||
'webp' => 'image/webp',
|
||||
);
|
||||
|
||||
$this->updateMimetypes($updatedMimetypes);
|
||||
}
|
||||
|
||||
private function introduceWindowsProgramTypes() {
|
||||
$updatedMimetypes = array(
|
||||
'htaccess' => 'text/plain',
|
||||
|
@ -130,6 +139,10 @@ class RepairMimeTypes implements IRepairStep {
|
|||
// NOTE TO DEVELOPERS: when adding new mime types, please make sure to
|
||||
// add a version comparison to avoid doing it every time
|
||||
|
||||
if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.14', '<') && $this->introduceImageTypes()) {
|
||||
$out->info('Fixed image mime types');
|
||||
}
|
||||
|
||||
if (version_compare($ocVersionFromBeforeUpdate, '12.0.0.13', '<') && $this->introduceWindowsProgramTypes()) {
|
||||
$out->info('Fixed windows program mime types');
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
"iiq": ["image/x-dcraw"],
|
||||
"impress": ["text/impress"],
|
||||
"java": ["text/x-java-source"],
|
||||
"jp2": ["image/jp2"],
|
||||
"jpeg": ["image/jpeg"],
|
||||
"jpg": ["image/jpeg"],
|
||||
"jps": ["image/jpeg"],
|
||||
|
@ -170,6 +171,7 @@
|
|||
"vsd": ["application/vnd.visio"],
|
||||
"wav": ["audio/wav"],
|
||||
"webm": ["video/webm"],
|
||||
"webp": ["image/webp"],
|
||||
"woff": ["application/font-woff"],
|
||||
"wpd": ["application/vnd.wordperfect"],
|
||||
"wmv": ["video/x-ms-wmv"],
|
||||
|
|
|
@ -106,6 +106,23 @@ class RepairMimeTypesTest extends \Test\TestCase {
|
|||
$this->checkEntries($fixedMimeTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test renaming the additional image mime types
|
||||
*/
|
||||
public function testRenameImageTypes() {
|
||||
$currentMimeTypes = [
|
||||
['test.jp2', 'application/octet-stream'],
|
||||
['test.webp', 'application/octet-stream'],
|
||||
];
|
||||
|
||||
$fixedMimeTypes = [
|
||||
['test.jp2', 'image/jp2'],
|
||||
['test.webp', 'image/webp'],
|
||||
];
|
||||
|
||||
$this->renameMimeTypes($currentMimeTypes, $fixedMimeTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test renaming the richdocuments additional office mime types
|
||||
*/
|
||||
|
@ -163,8 +180,10 @@ class RepairMimeTypesTest extends \Test\TestCase {
|
|||
['test.sr2', 'image/x-dcraw'],
|
||||
['test.xrf', 'image/x-dcraw'],
|
||||
['test.DNG', 'image/x-dcraw'],
|
||||
['test.jp2', 'image/jp2'],
|
||||
['test.jps', 'image/jpeg'],
|
||||
['test.MPO', 'image/jpeg'],
|
||||
['test.webp', 'image/webp'],
|
||||
['test.conf', 'text/plain'],
|
||||
['test.cnf', 'text/plain'],
|
||||
['test.yaml', 'application/yaml'],
|
||||
|
@ -215,8 +234,10 @@ class RepairMimeTypesTest extends \Test\TestCase {
|
|||
['test.sr2', 'image/x-dcraw'],
|
||||
['test.xrf', 'image/x-dcraw'],
|
||||
['test.DNG', 'image/x-dcraw'],
|
||||
['test.jp2', 'image/jp2'],
|
||||
['test.jps', 'image/jpeg'],
|
||||
['test.MPO', 'image/jpeg'],
|
||||
['test.webp', 'image/webp'],
|
||||
['test.conf', 'text/plain'],
|
||||
['test.cnf', 'text/plain'],
|
||||
['test.yaml', 'application/yaml'],
|
||||
|
|
Loading…
Reference in a new issue