Merge pull request #19272 from owncloud/mimetypes-enhanced
Introduce a few new mimetypes for code, fix recursive mimetype aliases
This commit is contained in:
commit
ff89824135
|
@ -70,7 +70,7 @@ OC.MimeType = {
|
|||
return undefined;
|
||||
}
|
||||
|
||||
if (mimeType in OC.MimeTypeList.aliases) {
|
||||
while (mimeType in OC.MimeTypeList.aliases) {
|
||||
mimeType = OC.MimeTypeList.aliases[mimeType];
|
||||
}
|
||||
if (mimeType in OC.MimeType._mimeTypeIcons) {
|
||||
|
|
|
@ -9,23 +9,26 @@
|
|||
OC.MimeTypeList={
|
||||
aliases: {
|
||||
"application/coreldraw": "image",
|
||||
"application/font-sfnt": "font",
|
||||
"application/font-woff": "font",
|
||||
"application/illustrator": "image/vector",
|
||||
"application/epub+zip": "text",
|
||||
"application/font-sfnt": "image",
|
||||
"application/font-woff": "image",
|
||||
"application/illustrator": "image",
|
||||
"application/javascript": "text/code",
|
||||
"application/json": "text/code",
|
||||
"application/msaccess": "database",
|
||||
"application/msaccess": "file",
|
||||
"application/msexcel": "x-office/spreadsheet",
|
||||
"application/mspowerpoint": "x-office/presentation",
|
||||
"application/msword": "x-office/document",
|
||||
"application/octet-stream": "file",
|
||||
"application/postscript": "image/vector",
|
||||
"application/postscript": "image",
|
||||
"application/rss+xml": "application/xml",
|
||||
"application/vnd.android.package-archive": "package/x-generic",
|
||||
"application/vnd.ms-excel": "x-office/spreadsheet",
|
||||
"application/vnd.ms-excel.addin.macroEnabled.12": "x-office/spreadsheet",
|
||||
"application/vnd.ms-excel.sheet.binary.macroEnabled.12": "x-office/spreadsheet",
|
||||
"application/vnd.ms-excel.sheet.macroEnabled.12": "x-office/spreadsheet",
|
||||
"application/vnd.ms-excel.template.macroEnabled.12": "x-office/spreadsheet",
|
||||
"application/vnd.ms-fontobject": "font",
|
||||
"application/vnd.ms-fontobject": "image",
|
||||
"application/vnd.ms-powerpoint": "x-office/presentation",
|
||||
"application/vnd.ms-powerpoint.addin.macroEnabled.12": "x-office/presentation",
|
||||
"application/vnd.ms-powerpoint.presentation.macroEnabled.12": "x-office/presentation",
|
||||
|
@ -49,10 +52,11 @@ OC.MimeTypeList={
|
|||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "x-office/document",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.template": "x-office/document",
|
||||
"application/x-7z-compressed": "package/x-generic",
|
||||
"application/x-cbr": "text",
|
||||
"application/x-compressed": "package/x-generic",
|
||||
"application/x-dcraw": "image",
|
||||
"application/x-deb": "package/x-generic",
|
||||
"application/x-font": "font",
|
||||
"application/x-font": "image",
|
||||
"application/x-gimp": "image",
|
||||
"application/x-gzip": "package/x-generic",
|
||||
"application/x-perl": "text/code",
|
||||
|
@ -64,33 +68,40 @@ OC.MimeTypeList={
|
|||
"application/xml": "text/html",
|
||||
"application/yaml": "text/code",
|
||||
"application/zip": "package/x-generic",
|
||||
"database": "file",
|
||||
"httpd/unix-directory": "dir",
|
||||
"image/svg+xml": "image/vector",
|
||||
"text/css": "text/code",
|
||||
"text/csv": "x-office/spreadsheet",
|
||||
"text/x-shellscript": "text/code"
|
||||
"text/html": "text/code",
|
||||
"text/x-c": "text/code",
|
||||
"text/x-c++src": "text/code",
|
||||
"text/x-h": "text/code",
|
||||
"text/x-java-source": "text/code",
|
||||
"text/x-python": "text/code",
|
||||
"text/x-shellscript": "text/code",
|
||||
"web": "text/code"
|
||||
},
|
||||
files: [
|
||||
"application-pdf",
|
||||
"application",
|
||||
"audio",
|
||||
"file",
|
||||
"folder-drag-accept",
|
||||
"folder-external",
|
||||
"folder-public",
|
||||
"folder-shared",
|
||||
"folder-starred",
|
||||
"folder",
|
||||
"image",
|
||||
"package-x-generic",
|
||||
"text-calendar",
|
||||
"text-code",
|
||||
"text-vcard",
|
||||
"text",
|
||||
"video",
|
||||
"folder-drag-accept",
|
||||
"folder-starred",
|
||||
"folder-public",
|
||||
"package-x-generic",
|
||||
"text",
|
||||
"folder-external",
|
||||
"text-vcard",
|
||||
"application",
|
||||
"text-code",
|
||||
"x-office-spreadsheet",
|
||||
"application-pdf",
|
||||
"folder",
|
||||
"x-office-document",
|
||||
"text-calendar",
|
||||
"x-office-presentation",
|
||||
"x-office-spreadsheet"
|
||||
"file",
|
||||
"folder-shared",
|
||||
"image",
|
||||
"audio"
|
||||
],
|
||||
themes: []
|
||||
};
|
||||
|
|
|
@ -269,7 +269,7 @@ class Detection implements IMimeTypeDetector {
|
|||
public function mimeTypeIcon($mimetype) {
|
||||
$this->loadAliases();
|
||||
|
||||
if (isset($this->mimeTypeAlias[$mimetype])) {
|
||||
while (isset($this->mimeTypeAlias[$mimetype])) {
|
||||
$mimetype = $this->mimeTypeAlias[$mimetype];
|
||||
}
|
||||
if (isset($this->mimetypeIcons[$mimetype])) {
|
||||
|
|
|
@ -250,6 +250,39 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
|
|||
self::updateMimetypes($updatedMimetypes);
|
||||
}
|
||||
|
||||
private function introduceJavaMimeType() {
|
||||
$updatedMimetypes = array(
|
||||
'class' => 'application/java',
|
||||
'java' => 'text/x-java-source',
|
||||
);
|
||||
|
||||
self::updateMimetypes($updatedMimetypes);
|
||||
}
|
||||
|
||||
private function introduceHppMimeType() {
|
||||
$updatedMimetypes = array(
|
||||
'hpp' => 'text/x-h',
|
||||
);
|
||||
|
||||
self::updateMimetypes($updatedMimetypes);
|
||||
}
|
||||
|
||||
private function introduceRssMimeType() {
|
||||
$updatedMimetypes = array(
|
||||
'rss' => 'application/rss+xml',
|
||||
);
|
||||
|
||||
self::updateMimetypes($updatedMimetypes);
|
||||
}
|
||||
|
||||
private function introduceRtfMimeType() {
|
||||
$updatedMimetypes = array(
|
||||
'rtf' => 'text/rtf',
|
||||
);
|
||||
|
||||
self::updateMimetypes($updatedMimetypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fix mime types
|
||||
*/
|
||||
|
@ -294,5 +327,24 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
|
|||
$this->emit('\OC\Repair', 'info', array('Fixed Yaml/Yml mime types'));
|
||||
}
|
||||
}
|
||||
|
||||
// Mimetype updates from #19272
|
||||
if (version_compare($ocVersionFromBeforeUpdate, '8.2.0.8', '<')) {
|
||||
if ($this->introduceJavaMimeType()) {
|
||||
$this->emit('\OC\Repair', 'info', array('Fixed java/class mime types'));
|
||||
}
|
||||
|
||||
if ($this->introduceHppMimeType()) {
|
||||
$this->emit('\OC\Repair', 'info', array('Fixed hpp mime type'));
|
||||
}
|
||||
|
||||
if ($this->introduceRssMimeType()) {
|
||||
$this->emit('\OC\Repair', 'info', array('Fixed rss mime type'));
|
||||
}
|
||||
|
||||
if ($this->introduceRtfMimeType()) {
|
||||
$this->emit('\OC\Repair', 'info', array('Fixed rtf mime type'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,23 +9,26 @@
|
|||
|
||||
|
||||
"application/coreldraw": "image",
|
||||
"application/font-sfnt": "font",
|
||||
"application/font-woff": "font",
|
||||
"application/illustrator": "image/vector",
|
||||
"application/epub+zip": "text",
|
||||
"application/font-sfnt": "image",
|
||||
"application/font-woff": "image",
|
||||
"application/illustrator": "image",
|
||||
"application/javascript": "text/code",
|
||||
"application/json": "text/code",
|
||||
"application/msaccess": "database",
|
||||
"application/msaccess": "file",
|
||||
"application/msexcel": "x-office/spreadsheet",
|
||||
"application/mspowerpoint": "x-office/presentation",
|
||||
"application/msword": "x-office/document",
|
||||
"application/octet-stream": "file",
|
||||
"application/postscript": "image/vector",
|
||||
"application/postscript": "image",
|
||||
"application/rss+xml": "application/xml",
|
||||
"application/vnd.android.package-archive": "package/x-generic",
|
||||
"application/vnd.ms-excel": "x-office/spreadsheet",
|
||||
"application/vnd.ms-excel.addin.macroEnabled.12": "x-office/spreadsheet",
|
||||
"application/vnd.ms-excel.sheet.binary.macroEnabled.12": "x-office/spreadsheet",
|
||||
"application/vnd.ms-excel.sheet.macroEnabled.12": "x-office/spreadsheet",
|
||||
"application/vnd.ms-excel.template.macroEnabled.12": "x-office/spreadsheet",
|
||||
"application/vnd.ms-fontobject": "font",
|
||||
"application/vnd.ms-fontobject": "image",
|
||||
"application/vnd.ms-powerpoint": "x-office/presentation",
|
||||
"application/vnd.ms-powerpoint.addin.macroEnabled.12": "x-office/presentation",
|
||||
"application/vnd.ms-powerpoint.presentation.macroEnabled.12": "x-office/presentation",
|
||||
|
@ -49,10 +52,11 @@
|
|||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": "x-office/document",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.template": "x-office/document",
|
||||
"application/x-7z-compressed": "package/x-generic",
|
||||
"application/x-cbr": "text",
|
||||
"application/x-compressed": "package/x-generic",
|
||||
"application/x-dcraw": "image",
|
||||
"application/x-deb": "package/x-generic",
|
||||
"application/x-font": "font",
|
||||
"application/x-font": "image",
|
||||
"application/x-gimp": "image",
|
||||
"application/x-gzip": "package/x-generic",
|
||||
"application/x-perl": "text/code",
|
||||
|
@ -64,10 +68,17 @@
|
|||
"application/xml": "text/html",
|
||||
"application/yaml": "text/code",
|
||||
"application/zip": "package/x-generic",
|
||||
"database": "file",
|
||||
"httpd/unix-directory": "dir",
|
||||
"image/svg+xml": "image/vector",
|
||||
"text/css": "text/code",
|
||||
"text/csv": "x-office/spreadsheet",
|
||||
"text/x-shellscript": "text/code"
|
||||
"text/html": "text/code",
|
||||
"text/x-c": "text/code",
|
||||
"text/x-c++src": "text/code",
|
||||
"text/x-h": "text/code",
|
||||
"text/x-java-source": "text/code",
|
||||
"text/x-python": "text/code",
|
||||
"text/x-shellscript": "text/code",
|
||||
"web": "text/code"
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
"cbz": ["application/x-cbr"],
|
||||
"cc": ["text/x-c"],
|
||||
"cdr": ["application/coreldraw"],
|
||||
"class": ["application/java"],
|
||||
"cnf": ["text/plain"],
|
||||
"conf": ["text/plain"],
|
||||
"cpp": ["text/x-c++src"],
|
||||
|
@ -57,12 +58,14 @@
|
|||
"gzip": ["application/x-gzip"],
|
||||
"h": ["text/x-h"],
|
||||
"hh": ["text/x-h"],
|
||||
"hpp": ["text/x-h"],
|
||||
"html": ["text/html", "text/plain"],
|
||||
"htm": ["text/html", "text/plain"],
|
||||
"ical": ["text/calendar"],
|
||||
"ics": ["text/calendar"],
|
||||
"iiq": ["image/x-dcraw"],
|
||||
"impress": ["text/impress"],
|
||||
"java": ["text/x-java-source"],
|
||||
"jpeg": ["image/jpeg"],
|
||||
"jpg": ["image/jpeg"],
|
||||
"jps": ["image/jpeg"],
|
||||
|
@ -130,6 +133,8 @@
|
|||
"raf": ["image/x-dcraw"],
|
||||
"rar": ["application/x-rar-compressed"],
|
||||
"reveal": ["text/reveal"],
|
||||
"rss": ["application/rss+xml"],
|
||||
"rtf": ["text/rtf"],
|
||||
"rw2": ["image/x-dcraw"],
|
||||
"sgf": ["application/sgf"],
|
||||
"sh-lib": ["text/x-shellscript"],
|
||||
|
|
|
@ -282,6 +282,68 @@ class RepairMimeTypes extends \Test\TestCase {
|
|||
$this->renameMimeTypes($currentMimeTypes, $fixedMimeTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test renaming the java mime types
|
||||
*/
|
||||
public function testRenameJavaMimeType() {
|
||||
$currentMimeTypes = [
|
||||
['test.java', 'application/octet-stream'],
|
||||
['test.class', 'application/octet-stream'],
|
||||
];
|
||||
|
||||
$fixedMimeTypes = [
|
||||
['test.java', 'text/x-java-source'],
|
||||
['test.class', 'application/java'],
|
||||
];
|
||||
|
||||
$this->renameMimeTypes($currentMimeTypes, $fixedMimeTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test renaming the hpp mime type
|
||||
*/
|
||||
public function testRenameHppMimeType() {
|
||||
$currentMimeTypes = [
|
||||
['test.hpp', 'application/octet-stream'],
|
||||
];
|
||||
|
||||
$fixedMimeTypes = [
|
||||
['test.hpp', 'text/x-h'],
|
||||
];
|
||||
|
||||
$this->renameMimeTypes($currentMimeTypes, $fixedMimeTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test renaming the rss mime type
|
||||
*/
|
||||
public function testRenameRssMimeType() {
|
||||
$currentMimeTypes = [
|
||||
['test.rss', 'application/octet-stream'],
|
||||
];
|
||||
|
||||
$fixedMimeTypes = [
|
||||
['test.rss', 'application/rss+xml'],
|
||||
];
|
||||
|
||||
$this->renameMimeTypes($currentMimeTypes, $fixedMimeTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test renaming the hpp mime type
|
||||
*/
|
||||
public function testRenameRtfMimeType() {
|
||||
$currentMimeTypes = [
|
||||
['test.rtf', 'application/octet-stream'],
|
||||
];
|
||||
|
||||
$fixedMimeTypes = [
|
||||
['test.rtf', 'text/rtf'],
|
||||
];
|
||||
|
||||
$this->renameMimeTypes($currentMimeTypes, $fixedMimeTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test renaming and splitting old office mime types when
|
||||
* new ones already exist
|
||||
|
@ -399,6 +461,11 @@ class RepairMimeTypes extends \Test\TestCase {
|
|||
['test.cnf', 'text/plain'],
|
||||
['test.yaml', 'application/yaml'],
|
||||
['test.yml', 'application/yaml'],
|
||||
['test.java', 'text/x-java-source'],
|
||||
['test.class', 'application/java'],
|
||||
['test.hpp', 'text/x-h'],
|
||||
['test.rss', 'application/rss+xml'],
|
||||
['test.rtf', 'text/rtf'],
|
||||
];
|
||||
|
||||
$fixedMimeTypes = [
|
||||
|
@ -438,6 +505,11 @@ class RepairMimeTypes extends \Test\TestCase {
|
|||
['test.cnf', 'text/plain'],
|
||||
['test.yaml', 'application/yaml'],
|
||||
['test.yml', 'application/yaml'],
|
||||
['test.java', 'text/x-java-source'],
|
||||
['test.class', 'application/java'],
|
||||
['test.hpp', 'text/x-h'],
|
||||
['test.rss', 'application/rss+xml'],
|
||||
['test.rtf', 'text/rtf'],
|
||||
];
|
||||
|
||||
$this->renameMimeTypes($currentMimeTypes, $fixedMimeTypes);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
// We only can count up. The 4. digit is only for the internal patchlevel to trigger DB upgrades
|
||||
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel
|
||||
// when updating major/minor version number.
|
||||
$OC_Version = array(8, 2, 0, 7);
|
||||
$OC_Version = array(8, 2, 0, 8);
|
||||
|
||||
// The human readable string
|
||||
$OC_VersionString = '8.2 beta1';
|
||||
|
|
Loading…
Reference in New Issue