diff options
Diffstat (limited to 'includes/libs/mime')
-rw-r--r-- | includes/libs/mime/MimeAnalyzer.php | 231 | ||||
-rw-r--r-- | includes/libs/mime/MimeMap.php | 502 | ||||
-rw-r--r-- | includes/libs/mime/MimeMapMinimal.php | 159 | ||||
-rw-r--r-- | includes/libs/mime/mime.info | 123 | ||||
-rw-r--r-- | includes/libs/mime/mime.types | 190 |
5 files changed, 711 insertions, 494 deletions
diff --git a/includes/libs/mime/MimeAnalyzer.php b/includes/libs/mime/MimeAnalyzer.php index d525acc66963..274c175a3adb 100644 --- a/includes/libs/mime/MimeAnalyzer.php +++ b/includes/libs/mime/MimeAnalyzer.php @@ -22,6 +22,8 @@ use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; +use Wikimedia\Mime\MimeMap; +use Wikimedia\Mime\MimeMapMinimal; /** * Implements functions related to MIME types such as detection and mapping to file extension @@ -64,118 +66,8 @@ class MimeAnalyzer implements LoggerAwareInterface { /** @var LoggerInterface */ private $logger; - /** - * Defines a set of well known MIME types - * This is used as a fallback to mime.types files. - * An extensive list of well known MIME types is provided by - * the file mime.types in the includes directory. - * - * This list concatenated with mime.types is used to create a MIME <-> ext - * map. Each line contains a MIME type followed by a space separated list of - * extensions. If multiple extensions for a single MIME type exist or if - * multiple MIME types exist for a single extension then in most cases - * MediaWiki assumes that the first extension following the MIME type is the - * canonical extension, and the first time a MIME type appears for a certain - * extension is considered the canonical MIME type. - * - * (Note that appending the type file list to the end of self::$wellKnownTypes - * sucks because you can't redefine canonical types. This could be fixed by - * appending self::$wellKnownTypes behind type file list, but who knows - * what will break? In practice this probably isn't a problem anyway -- Bryan) - */ - protected static $wellKnownTypes = <<<EOT -application/ogg ogx ogg ogm ogv oga spx opus -application/pdf pdf -application/vnd.oasis.opendocument.chart odc -application/vnd.oasis.opendocument.chart-template otc -application/vnd.oasis.opendocument.database odb -application/vnd.oasis.opendocument.formula odf -application/vnd.oasis.opendocument.formula-template otf -application/vnd.oasis.opendocument.graphics odg -application/vnd.oasis.opendocument.graphics-template otg -application/vnd.oasis.opendocument.image odi -application/vnd.oasis.opendocument.image-template oti -application/vnd.oasis.opendocument.presentation odp -application/vnd.oasis.opendocument.presentation-template otp -application/vnd.oasis.opendocument.spreadsheet ods -application/vnd.oasis.opendocument.spreadsheet-template ots -application/vnd.oasis.opendocument.text odt -application/vnd.oasis.opendocument.text-master otm -application/vnd.oasis.opendocument.text-template ott -application/vnd.oasis.opendocument.text-web oth -application/javascript js -application/x-shockwave-flash swf -audio/midi mid midi kar -audio/mpeg mpga mpa mp2 mp3 -audio/x-aiff aif aiff aifc -audio/x-wav wav -audio/ogg oga spx ogg opus -audio/opus opus ogg oga ogg spx -image/x-bmp bmp -image/gif gif -image/jpeg jpeg jpg jpe -image/png png -image/svg+xml svg -image/svg svg -image/tiff tiff tif -image/vnd.djvu djvu -image/x.djvu djvu -image/x-djvu djvu -image/x-portable-pixmap ppm -image/x-xcf xcf -text/plain txt -text/html html htm -video/ogg ogv ogm ogg -video/mpeg mpg mpeg -EOT; - - /** - * Defines a set of well known MIME info entries - * This is used as a fallback to mime.info files. - * An extensive list of well known MIME types is provided by - * the file mime.info in the includes directory. - */ - protected static $wellKnownInfo = <<<EOT -application/pdf [OFFICE] -application/vnd.oasis.opendocument.chart [OFFICE] -application/vnd.oasis.opendocument.chart-template [OFFICE] -application/vnd.oasis.opendocument.database [OFFICE] -application/vnd.oasis.opendocument.formula [OFFICE] -application/vnd.oasis.opendocument.formula-template [OFFICE] -application/vnd.oasis.opendocument.graphics [OFFICE] -application/vnd.oasis.opendocument.graphics-template [OFFICE] -application/vnd.oasis.opendocument.image [OFFICE] -application/vnd.oasis.opendocument.image-template [OFFICE] -application/vnd.oasis.opendocument.presentation [OFFICE] -application/vnd.oasis.opendocument.presentation-template [OFFICE] -application/vnd.oasis.opendocument.spreadsheet [OFFICE] -application/vnd.oasis.opendocument.spreadsheet-template [OFFICE] -application/vnd.oasis.opendocument.text [OFFICE] -application/vnd.oasis.opendocument.text-template [OFFICE] -application/vnd.oasis.opendocument.text-master [OFFICE] -application/vnd.oasis.opendocument.text-web [OFFICE] -application/javascript text/javascript application/x-javascript [EXECUTABLE] -application/x-shockwave-flash [MULTIMEDIA] -audio/midi [AUDIO] -audio/x-aiff [AUDIO] -audio/x-wav [AUDIO] -audio/mp3 audio/mpeg [AUDIO] -application/ogg audio/ogg video/ogg [MULTIMEDIA] -image/x-bmp image/x-ms-bmp image/bmp [BITMAP] -image/gif [BITMAP] -image/jpeg [BITMAP] -image/png [BITMAP] -image/svg+xml [DRAWING] -image/tiff [BITMAP] -image/vnd.djvu [BITMAP] -image/x-xcf [BITMAP] -image/x-portable-pixmap [BITMAP] -text/plain [TEXT] -text/html [TEXT] -video/ogg [VIDEO] -video/mpeg [VIDEO] -unknown/unknown application/octet-stream application/x-empty [UNKNOWN] -EOT; + /** @var string Use the full, built-in MIME mapping rather than load from a file */ + public const USE_INTERNAL = 'internal'; /** * @param array $params Configuration map, includes: @@ -206,40 +98,56 @@ EOT; } protected function loadFiles() { - /** - * --- load mime.types --- - */ - # Allow media handling extensions adding MIME-types and MIME-info if ( $this->initCallback ) { call_user_func( $this->initCallback, $this ); } - $types = self::$wellKnownTypes; - - $mimeTypeFile = $this->typeFile; - if ( $mimeTypeFile ) { - if ( is_file( $mimeTypeFile ) && is_readable( $mimeTypeFile ) ) { - $this->logger->info( __METHOD__ . ": loading mime types from $mimeTypeFile\n" ); - $types .= "\n"; - $types .= file_get_contents( $mimeTypeFile ); - } else { - $this->logger->info( __METHOD__ . ": can't load mime types from $mimeTypeFile\n" ); - } + $rawTypes = $this->extraTypes; + if ( $this->typeFile === self::USE_INTERNAL ) { + $this->mimeToExt = MimeMap::MIME_EXTENSIONS; } else { - $this->logger->info( __METHOD__ . - ": no mime types file defined, using built-ins only.\n" ); + $this->mimeToExt = MimeMapMinimal::MIME_EXTENSIONS; + if ( $this->typeFile ) { + $rawTypes = file_get_contents( $this->typeFile ) . "\n" . $this->extraTypes; + } + } + if ( $rawTypes ) { + $this->parseMimeTypes( $rawTypes ); } - $types .= "\n" . $this->extraTypes; + // Build the reverse mapping (extension => MIME type). + foreach ( $this->mimeToExt as $mime => $exts ) { + foreach ( explode( ' ', $exts ) as $ext ) { + if ( isset( $this->mExtToMime[$ext] ) ) { + $this->mExtToMime[$ext] .= " " . $mime; + } else { + $this->mExtToMime[$ext] = $mime; + } + } + } - $types = str_replace( [ "\r\n", "\n\r", "\n\n", "\r\r", "\r" ], "\n", $types ); - $types = str_replace( "\t", " ", $types ); + $rawInfo = $this->extraInfo; + if ( $this->infoFile === self::USE_INTERNAL ) { + $this->mimeTypeAliases = MimeMap::MIME_TYPE_ALIASES; + $this->mediaTypes = MimeMap::MEDIA_TYPES; + } else { + $this->mimeTypeAliases = MimeMapMinimal::MIME_TYPE_ALIASES; + $this->mediaTypes = MimeMapMinimal::MEDIA_TYPES; + if ( $this->infoFile ) { + $rawInfo = file_get_contents( $this->infoFile ) . "\n" . $this->extraInfo; + } + } + if ( $rawInfo ) { + $this->parseMimeInfo( $rawInfo ); + } + } - $this->mimeToExt = []; - $this->mExtToMime = []; + protected function parseMimeTypes( $rawMimeTypes ) { + $rawMimeTypes = str_replace( [ "\r\n", "\n\r", "\n\n", "\r\r", "\r" ], "\n", $rawMimeTypes ); + $rawMimeTypes = str_replace( "\t", " ", $rawMimeTypes ); - $lines = explode( "\n", $types ); + $lines = explode( "\n", $rawMimeTypes ); foreach ( $lines as $s ) { $s = trim( $s ); if ( empty( $s ) ) { @@ -268,53 +176,14 @@ EOT; } else { $this->mimeToExt[$mime] = $ext; } - - $extensions = explode( ' ', $ext ); - - foreach ( $extensions as $e ) { - $e = trim( $e ); - if ( empty( $e ) ) { - continue; - } - - if ( !empty( $this->mExtToMime[$e] ) ) { - $this->mExtToMime[$e] .= ' ' . $mime; - } else { - $this->mExtToMime[$e] = $mime; - } - } } + } - /** - * --- load mime.info --- - */ - - $mimeInfoFile = $this->infoFile; - - $info = self::$wellKnownInfo; - - if ( $mimeInfoFile ) { - if ( is_file( $mimeInfoFile ) && is_readable( $mimeInfoFile ) ) { - $this->logger->info( __METHOD__ . ": loading mime info from $mimeInfoFile\n" ); - $info .= "\n"; - $info .= file_get_contents( $mimeInfoFile ); - } else { - $this->logger->info( __METHOD__ . ": can't load mime info from $mimeInfoFile\n" ); - } - } else { - $this->logger->info( __METHOD__ . - ": no mime info file defined, using built-ins only.\n" ); - } - - $info .= "\n" . $this->extraInfo; - - $info = str_replace( [ "\r\n", "\n\r", "\n\n", "\r\r", "\r" ], "\n", $info ); - $info = str_replace( "\t", " ", $info ); - - $this->mimeTypeAliases = []; - $this->mediaTypes = []; + protected function parseMimeInfo( $rawMimeInfo ) { + $rawMimeInfo = str_replace( [ "\r\n", "\n\r", "\n\n", "\r\r", "\r" ], "\n", $rawMimeInfo ); + $rawMimeInfo = str_replace( "\t", " ", $rawMimeInfo ); - $lines = explode( "\n", $info ); + $lines = explode( "\n", $rawMimeInfo ); foreach ( $lines as $s ) { $s = trim( $s ); if ( empty( $s ) ) { @@ -374,7 +243,7 @@ EOT; /** * Adds to the list mapping MIME to file extensions. * As an extension author, you are encouraged to submit patches to - * MediaWiki's core to add new MIME types to mime.types. + * MediaWiki's core to add new MIME types to MimeMap.php. * @param string $types */ public function addExtraTypes( $types ) { @@ -384,7 +253,7 @@ EOT; /** * Adds to the list mapping MIME to media type. * As an extension author, you are encouraged to submit patches to - * MediaWiki's core to add new MIME info to mime.info. + * MediaWiki's core to add new MIME info to MimeMap.php. * @param string $info */ public function addExtraInfo( $info ) { diff --git a/includes/libs/mime/MimeMap.php b/includes/libs/mime/MimeMap.php new file mode 100644 index 000000000000..303d18d61aa7 --- /dev/null +++ b/includes/libs/mime/MimeMap.php @@ -0,0 +1,502 @@ +<?php +/** + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * + * @file + */ + +namespace Wikimedia\Mime; + +/** + * MimeMap defines the mapping of MIME types to file extensions and media + * types. + * + * @internal + */ +class MimeMap { + /** @var array Map of MIME types to a string of space-separated file extensions */ + public const MIME_EXTENSIONS = [ + 'application/ogg' => 'ogx ogg ogm ogv oga spx opus', + 'application/pdf' => 'pdf', + 'application/vnd.oasis.opendocument.chart' => 'odc', + 'application/vnd.oasis.opendocument.chart-template' => 'otc', + 'application/vnd.oasis.opendocument.database' => 'odb', + 'application/vnd.oasis.opendocument.formula' => 'odf', + 'application/vnd.oasis.opendocument.formula-template' => 'otf', + 'application/vnd.oasis.opendocument.graphics' => 'odg', + 'application/vnd.oasis.opendocument.graphics-template' => 'otg', + 'application/vnd.oasis.opendocument.image' => 'odi', + 'application/vnd.oasis.opendocument.image-template' => 'oti', + 'application/vnd.oasis.opendocument.presentation' => 'odp', + 'application/vnd.oasis.opendocument.presentation-template' => 'otp', + 'application/vnd.oasis.opendocument.spreadsheet' => 'ods', + 'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots', + 'application/vnd.oasis.opendocument.text' => 'odt', + 'application/vnd.oasis.opendocument.text-master' => 'otm odm', + 'application/vnd.oasis.opendocument.text-template' => 'ott', + 'application/vnd.oasis.opendocument.text-web' => 'oth', + 'application/javascript' => 'js', + 'application/x-shockwave-flash' => 'swf', + 'audio/midi' => 'mid midi kar', + 'audio/mpeg' => 'mpga mpa mp2 mp3', + 'audio/x-aiff' => 'aif aiff aifc', + 'audio/x-wav' => 'wav', + 'audio/ogg' => 'oga spx ogg opus', + 'audio/opus' => 'opus ogg oga spx', + 'image/x-bmp' => 'bmp', + 'image/gif' => 'gif', + 'image/jpeg' => 'jpeg jpg jpe', + 'image/png' => 'png apng', + 'image/svg+xml' => 'svg', + 'image/svg' => 'svg', + 'image/tiff' => 'tiff tif', + 'image/vnd.djvu' => 'djvu djv', + 'image/x.djvu' => 'djvu', + 'image/x-djvu' => 'djvu', + 'image/x-portable-pixmap' => 'ppm', + 'image/x-xcf' => 'xcf', + 'text/plain' => 'txt', + 'text/html' => 'html htm', + 'video/ogg' => 'ogv ogm ogg', + 'video/mpeg' => 'mpg mpeg mpe', + 'application/acad' => 'dwg', + 'application/andrew-inset' => 'ez', + 'application/mac-binhex40' => 'hqx', + 'application/mac-compactpro' => 'cpt', + 'application/mathml+xml' => 'mathml', + 'application/msword' => 'doc dot', + 'application/octet-stream' => 'bin dms lha lzh exe class so dll', + 'application/oda' => 'oda', + 'application/postscript' => 'ai eps ps', + 'application/rdf+xml' => 'rdf', + 'application/smil' => 'smi smil', + 'application/srgs' => 'gram', + 'application/srgs+xml' => 'grxml', + 'application/vnd.mif' => 'mif', + 'application/vnd.ms-excel' => 'xls xlt xla', + 'application/vnd.ms-powerpoint' => 'ppt pot pps ppa', + 'application/vnd.wap.wbxml' => 'wbxml', + 'application/vnd.wap.wmlc' => 'wmlc', + 'application/vnd.wap.wmlscriptc' => 'wmlsc', + 'application/voicexml+xml' => 'vxml', + 'application/x-7z-compressed' => '7z', + 'application/x-bcpio' => 'bcpio', + 'application/x-bzip' => 'bz', + 'application/x-bzip2' => 'bz2', + 'application/x-cdlink' => 'vcd', + 'application/x-chess-pgn' => 'pgn', + 'application/x-cpio' => 'cpio', + 'application/x-csh' => 'csh', + 'application/x-dia-diagram' => 'dia', + 'application/x-director' => 'dcr dir dxr', + 'application/x-dvi' => 'dvi', + 'application/x-futuresplash' => 'spl', + 'application/x-gtar' => 'gtar tar', + 'application/x-gzip' => 'gz', + 'application/x-hdf' => 'hdf', + 'application/x-jar' => 'jar', + 'application/json' => 'json', + 'application/x-koan' => 'skp skd skt skm', + 'application/x-latex' => 'latex', + 'application/x-netcdf' => 'nc cdf', + 'application/x-sh' => 'sh', + 'application/x-shar' => 'shar', + 'application/x-stuffit' => 'sit', + 'application/x-sv4cpio' => 'sv4cpio', + 'application/x-sv4crc' => 'sv4crc', + 'application/x-tar' => 'tar', + 'application/x-tcl' => 'tcl', + 'application/x-tex' => 'tex', + 'application/x-texinfo' => 'texinfo texi', + 'application/x-troff' => 't tr roff', + 'application/x-troff-man' => 'man', + 'application/x-troff-me' => 'me', + 'application/x-troff-ms' => 'ms', + 'application/x-ustar' => 'ustar', + 'application/x-wais-source' => 'src', + 'application/x-xpinstall' => 'xpi', + 'application/xhtml+xml' => 'xhtml xht', + 'application/xslt+xml' => 'xslt', + 'application/xml' => 'xml xsl xsd kml', + 'application/xml-dtd' => 'dtd', + 'application/zip' => 'zip jar xpi sxc stc sxd std sxi sti sxm stm sxw stw', + 'application/x-rar' => 'rar', + 'application/font-woff' => 'woff', + 'application/font-woff2' => 'woff2', + 'application/vnd.ms-fontobject' => 'eot', + 'application/x-font-ttf' => 'ttf', + 'audio/basic' => 'au snd', + 'video/webm' => 'webm', + 'audio/webm' => 'webm', + 'audio/x-matroska' => 'mka mkv', + 'audio/x-mpegurl' => 'm3u', + 'audio/x-ogg' => 'oga ogg spx opus', + 'audio/x-pn-realaudio' => 'ram rm', + 'audio/x-pn-realaudio-plugin' => 'rpm', + 'audio/x-realaudio' => 'ra', + 'audio/wav' => 'wav', + 'audio/x-flac' => 'flac', + 'audio/flac' => 'flac', + 'chemical/x-pdb' => 'pdb', + 'chemical/x-xyz' => 'xyz', + 'image/bmp' => 'bmp', + 'image/cgm' => 'cgm', + 'image/ief' => 'ief', + 'image/jp2' => 'j2k jp2 jpg2', + 'image/vnd.microsoft.icon' => 'ico', + 'image/vnd.wap.wbmp' => 'wbmp', + 'image/webp' => 'webp', + 'image/x-cmu-raster' => 'ras', + 'image/x-icon' => 'ico', + 'image/x-ms-bmp' => 'bmp', + 'image/x-portable-anymap' => 'pnm', + 'image/x-portable-bitmap' => 'pbm', + 'image/x-portable-graymap' => 'pgm', + 'image/x-rgb' => 'rgb', + 'image/x-photoshop' => 'psd', + 'image/x-xbitmap' => 'xbm', + 'image/x-xpixmap' => 'xpm', + 'image/x-xwindowdump' => 'xwd', + 'model/iges' => 'igs iges', + 'model/mesh' => 'msh mesh silo', + 'model/vrml' => 'wrl vrml', + 'text/calendar' => 'ics ifb', + 'text/css' => 'css', + 'text/csv' => 'csv', + 'text/richtext' => 'rtx', + 'text/rtf' => 'rtf', + 'text/sgml' => 'sgml sgm', + 'text/tab-separated-values' => 'tsv', + 'text/vnd.wap.wml' => 'wml', + 'text/vnd.wap.wmlscript' => 'wmls', + 'text/xml' => 'xml xsl xslt rss rdf', + 'text/x-component' => 'htc', + 'text/x-setext' => 'etx', + 'text/x-sawfish' => 'jl', + 'video/mp4' => 'mp4 m4a m4p m4b m4r m4v', + 'audio/mp4' => 'm4a', + 'video/quicktime' => 'qt mov', + 'video/vnd.mpegurl' => 'mxu', + 'video/x-flv' => 'flv', + 'video/x-matroska' => 'mkv mka', + 'video/x-msvideo' => 'avi', + 'video/x-ogg' => 'ogv ogm ogg', + 'video/x-sgi-movie' => 'movie', + 'x-conference/x-cooltalk' => 'ice', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template' => 'dotx', + 'application/vnd.ms-word.document.macroenabled.12' => 'docm', + 'application/vnd.ms-word.template.macroenabled.12' => 'dotm', + 'application/vnd.openxmlformats-officedocument.presentationml.template' => 'potx', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => 'ppsx', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx', + 'application/vnd.ms-powerpoint.addin.macroenabled.12' => 'ppam', + 'application/vnd.ms-powerpoint.presentation.macroenabled.12' => 'pptm potm', + 'application/vnd.ms-powerpoint.slideshow.macroenabled.12' => 'ppsm', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template' => 'xltx', + 'application/vnd.ms-excel.sheet.macroenabled.12' => 'xlsm', + 'application/vnd.ms-excel.template.macroenabled.12' => 'xltm', + 'application/vnd.ms-excel.addin.macroenabled.12' => 'xlam', + 'application/vnd.ms-excel.sheet.binary.macroenabled.12' => 'xlsb', + 'model/vnd.dwfx+xps' => 'dwfx', + 'application/vnd.ms-xpsdocument' => 'xps', + 'application/x-opc+zip' => + 'docx dotx docm dotm potx ppsx pptx ppam pptm potm ppsm xlsx xltx xlsm xltm xlam xlsb dwfx xps', + 'chemical/x-mdl-molfile' => 'mol', + 'chemical/x-mdl-sdfile' => 'sdf', + 'chemical/x-mdl-rxnfile' => 'rxn', + 'chemical/x-mdl-rdfile' => 'rd', + 'chemical/x-mdl-rgfile' => 'rg', + 'application/x-amf' => 'amf', + 'application/sla' => 'stl', + 'application/wasm' => 'wasm', + ]; + + /** @var array Map of built-in media types and their associated MIME types */ + public const MEDIA_TYPES = [ + MEDIATYPE_OFFICE => [ + 'application/pdf', + 'application/vnd.oasis.opendocument.chart', + 'application/vnd.oasis.opendocument.chart-template', + 'application/vnd.oasis.opendocument.database', + 'application/vnd.oasis.opendocument.formula', + 'application/vnd.oasis.opendocument.formula-template', + 'application/vnd.oasis.opendocument.graphics', + 'application/vnd.oasis.opendocument.graphics-template', + 'application/vnd.oasis.opendocument.image', + 'application/vnd.oasis.opendocument.image-template', + 'application/vnd.oasis.opendocument.presentation', + 'application/vnd.oasis.opendocument.presentation-template', + 'application/vnd.oasis.opendocument.spreadsheet', + 'application/vnd.oasis.opendocument.spreadsheet-template', + 'application/vnd.oasis.opendocument.text', + 'application/vnd.oasis.opendocument.text-template', + 'application/vnd.oasis.opendocument.text-master', + 'application/vnd.oasis.opendocument.text-web', + 'application/pdf', + 'application/acrobat', + 'application/msword', + 'application/vnd.ms-excel', + 'application/vnd.ms-powerpoint', + 'application/x-director', + 'image/vnd.djvu', + 'image/x.djvu', + 'image/x-djvu', + 'text/rtf', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'application/vnd.ms-word.document.macroenabled.12', + 'application/vnd.ms-word.template.macroenabled.12', + 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'application/vnd.ms-powerpoint.addin.macroenabled.12', + 'application/vnd.ms-powerpoint.presentation.macroenabled.12', + 'application/vnd.ms-powerpoint.presentation.macroenabled.12', + 'application/vnd.ms-powerpoint.slideshow.macroenabled.12', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'application/vnd.ms-excel.sheet.macroenabled.12', + 'application/vnd.ms-excel.template.macroenabled.12', + 'application/vnd.ms-excel.addin.macroenabled.12', + 'application/vnd.ms-excel.sheet.binary.macroenabled.12', + ], + MEDIATYPE_EXECUTABLE => [ + 'application/javascript', + 'text/javascript', + 'application/x-javascript', + 'application/javascript', + 'text/javascript', + 'application/x-javascript', + 'application/x-ecmascript', + 'text/ecmascript', + 'application/x-bash', + 'application/x-sh', + 'application/x-csh', + 'application/x-tcsh', + 'application/x-tcl', + 'application/x-perl', + 'application/x-python', + 'application/wasm', + ], + MEDIATYPE_MULTIMEDIA => [ + 'application/x-shockwave-flash', + 'application/ogg', + 'audio/ogg', + 'video/ogg', + 'application/ogg', + 'application/x-ogg', + 'audio/ogg', + 'audio/x-ogg', + 'video/ogg', + 'video/x-ogg', + 'application/x-shockwave-flash', + 'audio/x-pn-realaudio-plugin', + 'model/iges', + 'model/mesh', + 'model/vrml', + 'video/quicktime', + 'video/x-msvideo', + ], + MEDIATYPE_AUDIO => [ + 'audio/midi', + 'audio/x-aiff', + 'audio/x-wav', + 'audio/mp3', + 'audio/mpeg', + 'audio/mpeg', + 'audio/mp3', + 'audio/mpeg3', + 'audio/mp4', + 'audio/wav', + 'audio/x-wav', + 'audio/wave', + 'audio/midi', + 'audio/mid', + 'audio/basic', + 'audio/ogg', + 'audio/opus', + 'audio/x-aiff', + 'audio/x-pn-realaudio', + 'audio/x-realaudio', + 'audio/webm', + 'audio/x-matroska', + 'audio/x-flac', + 'audio/flac', + ], + MEDIATYPE_BITMAP => [ + 'image/x-bmp', + 'image/x-ms-bmp', + 'image/bmp', + 'image/gif', + 'image/jpeg', + 'image/png', + 'image/tiff', + 'image/vnd.djvu', + 'image/x-xcf', + 'image/x-portable-pixmap', + 'image/gif', + 'image/png', + 'image/x-png', + 'image/ief', + 'image/jpeg', + 'image/pjpeg', + 'image/jp2', + 'image/xbm', + 'image/tiff', + 'image/x-icon', + 'image/x-ico', + 'image/vnd.microsoft.icon', + 'image/x-rgb', + 'image/x-portable-pixmap', + 'image/x-portable-graymap', + 'image/x-portable-greymap', + 'image/x-bmp', + 'image/x-ms-bmp', + 'image/bmp', + 'application/x-bmp', + 'application/bmp', + 'image/x-photoshop', + 'image/psd', + 'image/x-psd', + 'image/photoshop', + 'image/vnd.adobe.photoshop', + 'image/webp', + ], + MEDIATYPE_DRAWING => [ + 'image/svg+xml', + 'image/svg+xml', + 'application/svg+xml', + 'application/svg', + 'image/svg', + 'application/postscript', + 'application/x-latex', + 'application/x-tex', + 'application/x-dia-diagram', + 'application/acad', + 'application/x-acad', + 'application/autocad_dwg', + 'image/x-dwg', + 'application/dwg', + 'application/x-dwg', + 'application/x-autocad', + 'image/vnd.dwg', + 'drawing/dwg', + 'chemical/x-mdl-molfile', + 'chemical/x-mdl-sdfile', + 'chemical/x-mdl-rxnfile', + 'chemical/x-mdl-rdfile', + 'chemical/x-mdl-rgfile', + ], + MEDIATYPE_TEXT => [ + 'text/plain', + 'text/html', + 'text/plain', + 'text/html', + 'application/xhtml+xml', + 'application/xml', + 'text/xml', + 'text', + 'application/json', + 'text/csv', + 'text/tab-separated-values', + ], + MEDIATYPE_VIDEO => [ + 'video/ogg', + 'video/mpeg', + 'video/mpeg', + 'application/mpeg', + 'video/ogg', + 'video/x-sgi-video', + 'video/x-flv', + 'video/webm', + 'video/x-matroska', + 'video/mp4', + ], + MEDIATYPE_UNKNOWN => [ + 'unknown/unknown', + 'application/octet-stream', + 'application/x-empty', + ], + MEDIATYPE_ARCHIVE => [ + 'application/zip', + 'application/x-zip', + 'application/x-gzip', + 'application/x-bzip', + 'application/x-bzip2', + 'application/x-tar', + 'application/x-stuffit', + 'application/x-opc+zip', + 'application/x-7z-compressed', + ], + MEDIATYPE_3D => [ + 'application/sla', + ], + ]; + + /** @var array Map of variant MIME types to their canonical MIME type */ + public const MIME_TYPE_ALIASES = [ + 'text/javascript' => 'application/javascript', + 'application/x-javascript' => 'application/javascript', + 'audio/mpeg' => 'audio/mp3', + 'audio/ogg' => 'application/ogg', + 'video/ogg' => 'application/ogg', + 'image/x-ms-bmp' => 'image/x-bmp', + 'image/bmp' => 'image/x-bmp', + 'application/octet-stream' => 'unknown/unknown', + 'application/x-empty' => 'unknown/unknown', + 'image/x-png' => 'image/png', + 'image/pjpeg' => 'image/jpeg', + 'image/x-ico' => 'image/x-icon', + 'image/vnd.microsoft.icon' => 'image/x-icon', + 'image/x-portable-greymap' => 'image/x-portable-graymap', + 'application/x-bmp' => 'image/x-bmp', + 'application/bmp' => 'image/x-bmp', + 'image/psd' => 'image/x-photoshop', + 'image/x-psd' => 'image/x-photoshop', + 'image/photoshop' => 'image/x-photoshop', + 'image/vnd.adobe.photoshop' => 'image/x-photoshop', + 'application/svg+xml' => 'image/svg+xml', + 'application/svg' => 'image/svg+xml', + 'image/svg' => 'image/svg+xml', + 'audio/mp3' => 'audio/mpeg', + 'audio/mpeg3' => 'audio/mpeg', + 'audio/x-wav' => 'audio/wav', + 'audio/wave' => 'audio/wav', + 'audio/mid' => 'audio/midi', + 'application/mpeg' => 'video/mpeg', + 'application/x-ogg' => 'application/ogg', + 'audio/x-ogg' => 'application/ogg', + 'video/x-ogg' => 'application/ogg', + 'application/xhtml+xml' => 'text/html', + 'text/xml' => 'application/xml', + 'application/x-zip' => 'application/zip', + 'application/x-ecmascript' => 'application/javascript', + 'text/ecmascript' => 'application/javascript', + 'application/acrobat' => 'application/pdf', + 'image/x.djvu' => 'image/vnd.djvu', + 'image/x-djvu' => 'image/vnd.djvu', + 'application/x-acad' => 'application/acad', + 'application/autocad_dwg' => 'application/acad', + 'image/x-dwg' => 'application/acad', + 'application/dwg' => 'application/acad', + 'application/x-dwg' => 'application/acad', + 'application/x-autocad' => 'application/acad', + 'image/vnd.dwg' => 'application/acad', + 'drawing/dwg' => 'application/acad', + ]; +} diff --git a/includes/libs/mime/MimeMapMinimal.php b/includes/libs/mime/MimeMapMinimal.php new file mode 100644 index 000000000000..740ed04706c2 --- /dev/null +++ b/includes/libs/mime/MimeMapMinimal.php @@ -0,0 +1,159 @@ +<?php +/** + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html + * + * @file + */ + +namespace Wikimedia\Mime; + +/** + * MimeMapMinimal defines a core set of MIME types that cannot be overridden by + * configuration. + * + * This class exists for backward compatibility ONLY. New MIME types should be + * added to MimeMap instead. + * + * @internal + */ +class MimeMapMinimal { + public const MIME_EXTENSIONS = [ + 'application/ogg' => 'ogx ogg ogm ogv oga spx opus', + 'application/pdf' => 'pdf', + 'application/vnd.oasis.opendocument.chart' => 'odc', + 'application/vnd.oasis.opendocument.chart-template' => 'otc', + 'application/vnd.oasis.opendocument.database' => 'odb', + 'application/vnd.oasis.opendocument.formula' => 'odf', + 'application/vnd.oasis.opendocument.formula-template' => 'otf', + 'application/vnd.oasis.opendocument.graphics' => 'odg', + 'application/vnd.oasis.opendocument.graphics-template' => 'otg', + 'application/vnd.oasis.opendocument.image' => 'odi', + 'application/vnd.oasis.opendocument.image-template' => 'oti', + 'application/vnd.oasis.opendocument.presentation' => 'odp', + 'application/vnd.oasis.opendocument.presentation-template' => 'otp', + 'application/vnd.oasis.opendocument.spreadsheet' => 'ods', + 'application/vnd.oasis.opendocument.spreadsheet-template' => 'ots', + 'application/vnd.oasis.opendocument.text' => 'odt', + 'application/vnd.oasis.opendocument.text-master' => 'otm', + 'application/vnd.oasis.opendocument.text-template' => 'ott', + 'application/vnd.oasis.opendocument.text-web' => 'oth', + 'application/javascript' => 'js', + 'application/x-shockwave-flash' => 'swf', + 'audio/midi' => 'mid midi kar', + 'audio/mpeg' => 'mpga mpa mp2 mp3', + 'audio/x-aiff' => 'aif aiff aifc', + 'audio/x-wav' => 'wav', + 'audio/ogg' => 'oga spx ogg opus', + 'audio/opus' => 'opus ogg oga spx', + 'image/x-bmp' => 'bmp', + 'image/gif' => 'gif', + 'image/jpeg' => 'jpeg jpg jpe', + 'image/png' => 'png', + 'image/svg+xml' => 'svg', + 'image/svg' => 'svg', + 'image/tiff' => 'tiff tif', + 'image/vnd.djvu' => 'djvu', + 'image/x.djvu' => 'djvu', + 'image/x-djvu' => 'djvu', + 'image/x-portable-pixmap' => 'ppm', + 'image/x-xcf' => 'xcf', + 'text/plain' => 'txt', + 'text/html' => 'html htm', + 'video/ogg' => 'ogv ogm ogg', + 'video/mpeg' => 'mpg mpeg', + ]; + + public const MEDIA_TYPES = [ + MEDIATYPE_OFFICE => [ + 'application/pdf', + 'application/vnd.oasis.opendocument.chart', + 'application/vnd.oasis.opendocument.chart-template', + 'application/vnd.oasis.opendocument.database', + 'application/vnd.oasis.opendocument.formula', + 'application/vnd.oasis.opendocument.formula-template', + 'application/vnd.oasis.opendocument.graphics', + 'application/vnd.oasis.opendocument.graphics-template', + 'application/vnd.oasis.opendocument.image', + 'application/vnd.oasis.opendocument.image-template', + 'application/vnd.oasis.opendocument.presentation', + 'application/vnd.oasis.opendocument.presentation-template', + 'application/vnd.oasis.opendocument.spreadsheet', + 'application/vnd.oasis.opendocument.spreadsheet-template', + 'application/vnd.oasis.opendocument.text', + 'application/vnd.oasis.opendocument.text-template', + 'application/vnd.oasis.opendocument.text-master', + 'application/vnd.oasis.opendocument.text-web', + ], + MEDIATYPE_EXECUTABLE => [ + 'application/javascript', + 'text/javascript', + 'application/x-javascript', + ], + MEDIATYPE_MULTIMEDIA => [ + 'application/x-shockwave-flash', + 'application/ogg', + 'audio/ogg', + 'video/ogg', + ], + MEDIATYPE_AUDIO => [ + 'audio/midi', + 'audio/x-aiff', + 'audio/x-wav', + 'audio/mp3', + 'audio/mpeg', + ], + MEDIATYPE_BITMAP => [ + 'image/x-bmp', + 'image/x-ms-bmp', + 'image/bmp', + 'image/gif', + 'image/jpeg', + 'image/png', + 'image/tiff', + 'image/vnd.djvu', + 'image/x-xcf', + 'image/x-portable-pixmap', + ], + MEDIATYPE_DRAWING => [ + 'image/svg+xml', + ], + MEDIATYPE_TEXT => [ + 'text/plain', + 'text/html', + ], + MEDIATYPE_VIDEO => [ + 'video/ogg', + 'video/mpeg', + ], + MEDIATYPE_UNKNOWN => [ + 'unknown/unknown', + 'application/octet-stream', + 'application/x-empty', + ], + ]; + + public const MIME_TYPE_ALIASES = [ + 'text/javascript' => 'application/javascript', + 'application/x-javascript' => 'application/javascript', + 'audio/mpeg' => 'audio/mp3', + 'audio/ogg' => 'application/ogg', + 'video/ogg' => 'application/ogg', + 'image/x-ms-bmp' => 'image/x-bmp', + 'image/bmp' => 'image/x-bmp', + 'application/octet-stream' => 'unknown/unknown', + 'application/x-empty' => 'unknown/unknown', + ]; +} diff --git a/includes/libs/mime/mime.info b/includes/libs/mime/mime.info deleted file mode 100644 index 8a79bc540aaa..000000000000 --- a/includes/libs/mime/mime.info +++ /dev/null @@ -1,123 +0,0 @@ -# MIME type info file. -# the first MIME type in each line is the "main" MIME type, -# the others are aliases for this type -# the media type is given in upper case and square brackets, -# like [BITMAP], and must indicate a media type as defined by -# the MEDIATYPE_xxx constants in Defines.php - - -image/gif [BITMAP] -image/png image/x-png [BITMAP] -image/ief [BITMAP] -image/jpeg image/pjpeg [BITMAP] -image/jp2 [BITMAP] -image/xbm [BITMAP] -image/tiff [BITMAP] -image/x-icon image/x-ico image/vnd.microsoft.icon [BITMAP] -image/x-rgb [BITMAP] -image/x-portable-pixmap [BITMAP] -image/x-portable-graymap image/x-portable-greymap [BITMAP] -image/x-bmp image/x-ms-bmp image/bmp application/x-bmp application/bmp [BITMAP] -image/x-photoshop image/psd image/x-psd image/photoshop image/vnd.adobe.photoshop [BITMAP] -image/webp [BITMAP] - -image/svg+xml application/svg+xml application/svg image/svg [DRAWING] -application/postscript [DRAWING] -application/x-latex [DRAWING] -application/x-tex [DRAWING] -application/x-dia-diagram [DRAWING] - - -audio/mpeg audio/mp3 audio/mpeg3 [AUDIO] -audio/mp4 [AUDIO] -audio/wav audio/x-wav audio/wave [AUDIO] -audio/midi audio/mid [AUDIO] -audio/basic [AUDIO] -audio/ogg [AUDIO] -audio/opus [AUDIO] -audio/x-aiff [AUDIO] -audio/x-pn-realaudio [AUDIO] -audio/x-realaudio [AUDIO] -audio/webm [AUDIO] -audio/x-matroska [AUDIO] -audio/x-flac [AUDIO] -audio/flac [AUDIO] - -video/mpeg application/mpeg [VIDEO] -video/ogg [VIDEO] -video/x-sgi-video [VIDEO] -video/x-flv [VIDEO] -video/webm [VIDEO] -video/x-matroska [VIDEO] -video/mp4 [VIDEO] - -application/ogg application/x-ogg audio/ogg audio/x-ogg video/ogg video/x-ogg [MULTIMEDIA] - -application/x-shockwave-flash [MULTIMEDIA] -audio/x-pn-realaudio-plugin [MULTIMEDIA] -model/iges [MULTIMEDIA] -model/mesh [MULTIMEDIA] -model/vrml [MULTIMEDIA] -video/quicktime [MULTIMEDIA] -video/x-msvideo [MULTIMEDIA] - -text/plain [TEXT] -text/html application/xhtml+xml [TEXT] -application/xml text/xml [TEXT] -text [TEXT] -application/json [TEXT] -text/csv [TEXT] -text/tab-separated-values [TEXT] - -application/zip application/x-zip [ARCHIVE] -application/x-gzip [ARCHIVE] -application/x-bzip [ARCHIVE] -application/x-bzip2 [ARCHIVE] -application/x-tar [ARCHIVE] -application/x-stuffit [ARCHIVE] -application/x-opc+zip [ARCHIVE] -application/x-7z-compressed [ARCHIVE] - -application/javascript text/javascript application/x-javascript application/x-ecmascript text/ecmascript [EXECUTABLE] -application/x-bash [EXECUTABLE] -application/x-sh [EXECUTABLE] -application/x-csh [EXECUTABLE] -application/x-tcsh [EXECUTABLE] -application/x-tcl [EXECUTABLE] -application/x-perl [EXECUTABLE] -application/x-python [EXECUTABLE] -application/wasm [EXECUTABLE] - -application/pdf application/acrobat [OFFICE] -application/msword [OFFICE] -application/vnd.ms-excel [OFFICE] -application/vnd.ms-powerpoint [OFFICE] -application/x-director [OFFICE] -image/vnd.djvu image/x.djvu image/x-djvu [OFFICE] -text/rtf [OFFICE] - -application/vnd.openxmlformats-officedocument.wordprocessingml.document [OFFICE] -application/vnd.openxmlformats-officedocument.wordprocessingml.template [OFFICE] -application/vnd.ms-word.document.macroEnabled.12 [OFFICE] -application/vnd.ms-word.template.macroEnabled.12 [OFFICE] -application/vnd.openxmlformats-officedocument.presentationml.template [OFFICE] -application/vnd.openxmlformats-officedocument.presentationml.slideshow [OFFICE] -application/vnd.openxmlformats-officedocument.presentationml.presentation [OFFICE] -application/vnd.ms-powerpoint.addin.macroEnabled.12 [OFFICE] -application/vnd.ms-powerpoint.presentation.macroEnabled.12 [OFFICE] -application/vnd.ms-powerpoint.presentation.macroEnabled.12 [OFFICE] -application/vnd.ms-powerpoint.slideshow.macroEnabled.12 [OFFICE] -application/vnd.openxmlformats-officedocument.spreadsheetml.sheet [OFFICE] -application/vnd.openxmlformats-officedocument.spreadsheetml.template [OFFICE] -application/vnd.ms-excel.sheet.macroEnabled.12 [OFFICE] -application/vnd.ms-excel.template.macroEnabled.12 [OFFICE] -application/vnd.ms-excel.addin.macroEnabled.12 [OFFICE] -application/vnd.ms-excel.sheet.binary.macroEnabled.12 [OFFICE] -application/acad application/x-acad application/autocad_dwg image/x-dwg application/dwg application/x-dwg application/x-autocad image/vnd.dwg drawing/dwg [DRAWING] -chemical/x-mdl-molfile [DRAWING] -chemical/x-mdl-sdfile [DRAWING] -chemical/x-mdl-rxnfile [DRAWING] -chemical/x-mdl-rdfile [DRAWING] -chemical/x-mdl-rgfile [DRAWING] - -application/sla [3D] diff --git a/includes/libs/mime/mime.types b/includes/libs/mime/mime.types deleted file mode 100644 index ef6854ce404d..000000000000 --- a/includes/libs/mime/mime.types +++ /dev/null @@ -1,190 +0,0 @@ -application/acad dwg -application/andrew-inset ez -application/mac-binhex40 hqx -application/mac-compactpro cpt -application/mathml+xml mathml -application/msword doc dot -application/octet-stream bin dms lha lzh exe class so dll -application/oda oda -application/ogg ogx ogg ogm ogv oga spx opus -application/pdf pdf -application/postscript ai eps ps -application/rdf+xml rdf -application/smil smi smil -application/srgs gram -application/srgs+xml grxml -application/vnd.mif mif -application/vnd.ms-excel xls xlt xla -application/vnd.ms-powerpoint ppt pot pps ppa -application/vnd.wap.wbxml wbxml -application/vnd.wap.wmlc wmlc -application/vnd.wap.wmlscriptc wmlsc -application/voicexml+xml vxml -application/x-7z-compressed 7z -application/x-bcpio bcpio -application/x-bzip bz -application/x-bzip2 bz2 -application/x-cdlink vcd -application/x-chess-pgn pgn -application/x-cpio cpio -application/x-csh csh -application/x-dia-diagram dia -application/x-director dcr dir dxr -application/x-dvi dvi -application/x-futuresplash spl -application/x-gtar gtar tar -application/x-gzip gz -application/x-hdf hdf -application/x-jar jar -application/javascript js -application/json json -application/x-koan skp skd skt skm -application/x-latex latex -application/x-netcdf nc cdf -application/x-sh sh -application/x-shar shar -application/x-shockwave-flash swf -application/x-stuffit sit -application/x-sv4cpio sv4cpio -application/x-sv4crc sv4crc -application/x-tar tar -application/x-tcl tcl -application/x-tex tex -application/x-texinfo texinfo texi -application/x-troff t tr roff -application/x-troff-man man -application/x-troff-me me -application/x-troff-ms ms -application/x-ustar ustar -application/x-wais-source src -application/x-xpinstall xpi -application/xhtml+xml xhtml xht -application/xslt+xml xslt -application/xml xml xsl xsd kml -application/xml-dtd dtd -application/zip zip jar xpi sxc stc sxd std sxi sti sxm stm sxw stw -application/x-rar rar -application/font-woff woff -application/font-woff2 woff2 -application/vnd.ms-fontobject eot -application/x-font-ttf ttf -audio/basic au snd -audio/midi mid midi kar -audio/mpeg mpga mp2 mp3 -audio/ogg oga ogg spx opus -audio/opus opus oga ogg -video/webm webm -audio/webm webm -audio/x-aiff aif aiff aifc -audio/x-matroska mka mkv -audio/x-mpegurl m3u -audio/x-ogg oga ogg spx opus -audio/x-pn-realaudio ram rm -audio/x-pn-realaudio-plugin rpm -audio/x-realaudio ra -audio/x-wav wav -audio/wav wav -audio/x-flac flac -audio/flac flac -chemical/x-pdb pdb -chemical/x-xyz xyz -image/bmp bmp -image/cgm cgm -image/gif gif -image/ief ief -image/jp2 j2k jp2 jpg2 -image/jpeg jpeg jpg jpe -image/png png apng -image/svg+xml svg -image/tiff tiff tif -image/vnd.djvu djvu djv -image/vnd.microsoft.icon ico -image/vnd.wap.wbmp wbmp -image/webp webp -image/x-cmu-raster ras -image/x-icon ico -image/x-ms-bmp bmp -image/x-portable-anymap pnm -image/x-portable-bitmap pbm -image/x-portable-graymap pgm -image/x-portable-pixmap ppm -image/x-rgb rgb -image/x-photoshop psd -image/x-xbitmap xbm -image/x-xpixmap xpm -image/x-xwindowdump xwd -model/iges igs iges -model/mesh msh mesh silo -model/vrml wrl vrml -text/calendar ics ifb -text/css css -text/csv csv -text/html html htm -text/plain txt -text/richtext rtx -text/rtf rtf -text/sgml sgml sgm -text/tab-separated-values tsv -text/vnd.wap.wml wml -text/vnd.wap.wmlscript wmls -text/xml xml xsl xslt rss rdf -text/x-component htc -text/x-setext etx -text/x-sawfish jl -video/mpeg mpeg mpg mpe -video/mp4 mp4 m4a m4p m4b m4r m4v -audio/mp4 m4a -video/ogg ogv ogm ogg -video/quicktime qt mov -video/vnd.mpegurl mxu -video/x-flv flv -video/x-matroska mkv mka -video/x-msvideo avi -video/x-ogg ogv ogm ogg -video/x-sgi-movie movie -x-conference/x-cooltalk ice -application/vnd.oasis.opendocument.chart odc -application/vnd.oasis.opendocument.chart-template otc -application/vnd.oasis.opendocument.database odb -application/vnd.oasis.opendocument.formula odf -application/vnd.oasis.opendocument.formula-template otf -application/vnd.oasis.opendocument.graphics odg -application/vnd.oasis.opendocument.graphics-template otg -application/vnd.oasis.opendocument.image odi -application/vnd.oasis.opendocument.image-template oti -application/vnd.oasis.opendocument.presentation odp -application/vnd.oasis.opendocument.presentation-template otp -application/vnd.oasis.opendocument.spreadsheet ods -application/vnd.oasis.opendocument.spreadsheet-template ots -application/vnd.oasis.opendocument.text odt -application/vnd.oasis.opendocument.text-master odm -application/vnd.oasis.opendocument.text-template ott -application/vnd.oasis.opendocument.text-web oth -application/vnd.openxmlformats-officedocument.wordprocessingml.document docx -application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx -application/vnd.ms-word.document.macroEnabled.12 docm -application/vnd.ms-word.template.macroEnabled.12 dotm -application/vnd.openxmlformats-officedocument.presentationml.template potx -application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx -application/vnd.openxmlformats-officedocument.presentationml.presentation pptx -application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam -application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm -application/vnd.ms-powerpoint.presentation.macroEnabled.12 potm -application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm -application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx -application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx -application/vnd.ms-excel.sheet.macroEnabled.12 xlsm -application/vnd.ms-excel.template.macroEnabled.12 xltm -application/vnd.ms-excel.addin.macroEnabled.12 xlam -application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb -model/vnd.dwfx+xps dwfx -application/vnd.ms-xpsdocument xps -application/x-opc+zip docx dotx docm dotm potx ppsx pptx ppam pptm potm ppsm xlsx xltx xlsm xltm xlam xlsb dwfx xps -chemical/x-mdl-molfile mol -chemical/x-mdl-sdfile sdf -chemical/x-mdl-rxnfile rxn -chemical/x-mdl-rdfile rd -chemical/x-mdl-rgfile rg -application/x-amf amf -application/sla stl -application/wasm wasm |