Commit graph

28 commits

Author SHA1 Message Date
jenkins-bot
79d908ef74 Merge "Fix mime detection of easily-confused-with text/plain formats" 2014-07-04 07:43:42 +00:00
rillke
c8a130dfd1 Detect chemical table files: Add them to MIME listings
Adding mol, sdf, rxn, rd and rg file types to mime.types and mime.info
map to make them known to MediaWiki by default.

PHP's own module fileinfo module is not capable detecting Chemical
table files. Instead, they are reported as text/plain.

MediaHandlers can be attached by MIME type only. That's why these
changes are required for [[Extension:MolHandler]] to work.

Change-Id: I017507e4a950b3ce4e6576d12217cd42a337bad6
2014-07-04 07:14:57 +00:00
Brian Wolff
69905ce9c7 Fix mime detection of easily-confused-with text/plain formats
json, csv, and tsv are often detected as text/plain. However that's
not right. This patch causes MediaWiki to look at the file extension
of files detected as text/plain, and if the file extension is
for a "textual" type, use the mime type associated with that extension.

This change also changes the "does mime type match uploaded file
extension" check to use the mime based on the file contents
plus extension, as opposed to just the file contents. Various
documentation suggests this is more appropriate (e.g. line 807
of MimeMagic.php). In my opinion we should use just the file
contents when verifying file is not on blacklist, but use ext
when verifying file type matches extension, and for decided
what handler specific checks to run. Not the detect mime type
with extension doesn't override the detected mime type with
the extension, but only uses the extension if content based
detection is ambigious or not specific enough.

This patch should be reviewed by csteipp before merge for
any potential security implications.

Note: This is partially fixing a regression from 3846d10487,
where previously csv and json files were allowed to be uploaded,
and that change prevented them

Bug: 66036
Bug: 45424
Change-Id: Ib637fe6850a81b26f84dc8c00ab4772f3d3a1f34
2014-07-04 04:03:31 -03:00
Brian Wolff
db7207fbf4 Add flac to mime.types and mime.info
Any format we allow uploading should be in these files.

We detect flac as audio/x-flac, but adding audio/flac
too, to be safe.

Change-Id: I564ff895cd0a6d4c6cd25bb565329b17a6771852
2013-08-23 14:06:18 -07:00
Brian Wolff
97f274fee1 Add MP4 to mime.types
Its a popular video format, we should recognize its type.

This will also prevent people from uploading mp4's to commons.

Wikipedia claims m4a sometimes used for video content.
RFC 4337 says audio/mp4 is mime type for mp4 with no
video (which is usually what an m4a extension means).

Bug: 52990
Change-Id: I5c24c3e318651241cced5b36d107d3603a289427
2013-08-19 13:25:32 -03:00
Bryan Tong Minh
a19704f1e8 Follow-up r104312, tab to space 2011-11-26 21:46:51 +00:00
Bryan Tong Minh
2898136a37 (bug 32630) Add image/vnd.adobe.photoshop as alias for image/x-photoshop 2011-11-26 21:45:08 +00:00
Sean Colombo
fe2af2f8d3 Merged Wikia change. 2011-09-14 00:27:48 +00:00
Bryan Tong Minh
519d5427e2 Per CR, revert non debugging stuff from r82436. (KML uploads) 2011-06-29 20:31:43 +00:00
Bryan Tong Minh
1e68a65787 (bug 18803) JPEG2000 images can no longer be uploaded as JPEG image. Done by adding the relevant mime info to mime.types and mime.info 2011-05-14 14:41:31 +00:00
Chad Horohoe
d684f95ed2 Revert r82922 (adding eml files to mime types). Per CR, these should be accompanied by appropriate sanity checks on upload 2011-04-16 00:16:02 +00:00
Mark A. Hershberger
d0970bee42 Add mime type/info for .eml files 2011-02-28 00:05:04 +00:00
Mark A. Hershberger
ec4dbd13cd Bug #26059 — Add support for KML/KMZ filetype
Patch from Derk-Jan Hartman of which he writes:

    I figured adding kml support would be a breeze, but I had not
    counted on the brain dead browser that is IE6.

    Unfortunately, kml contains the element <heading, which triggers
    the protection in detectScript() that protects from uploads that
    IE6 might mistake for HTML.  It triggers on "<head" not sure if we
    can work around this, but Tim will know.
2011-02-19 03:22:03 +00:00
Mark A. Hershberger
f96c0ddd63 re bug #25523: add mime.info and mime.types for *.dwg files so that when people add dwg to $wgFileExtensions, they can move files. 2011-02-18 21:54:19 +00:00
Derk-Jan Hartman
0e81f31105 Add support to upload WebP files. Disabled by default and no thumbnailing support.
Relates to bug 25397
2010-10-20 14:50:30 +00:00
Derk-Jan Hartman
bcd3dd1943 Recognize webm and matroska files. See also Bug 23888
Currently all webm files are stored as video/webm. It is not possible to detect 
wether this file is an audio file without using a full parser. This is why We should 
really move mime and mediatype accessors to the MediaHandlers.

Using video/x-matroska for MKV files. There is no official mime for MKV (though the 
webm isn't official either, but everyone is already using it apparently).
2010-07-28 19:24:00 +00:00
Derk-Jan Hartman
08c96166ee Bug 23642. Best effort mime detection for OpenXML files
OpenXML files are Open Package Convention files. Internally, we use the custom mime application/x-opc+zip for these files. In the database, we store the 'proper' mime, which we gu
ess from the file extension, or if not supported, application/zip. All OPC files are blacklisted by $wgMimeTypeBlacklist by default, just as other zip files.
2010-06-19 18:47:34 +00:00
Alexandre Emsenhuber
6a15026059 * (bug 23422) mp3 files can now be moved 2010-05-08 14:01:17 +00:00
Bryan Tong Minh
0a9762dd06 (bug 23375) Added ogv, oga, spx as extensions for ogg files. Patch by Derk-Jan Hartman. 2010-05-02 19:40:33 +00:00
Chad Horohoe
cadc248105 (bug 22935) image/x-ms-bmp mime type added for BMP files 2010-04-01 23:27:49 +00:00
Leon Weber
56efd64592 Also adding application/x-dia-diagram to mime.{types,info} 2008-04-27 14:28:29 +00:00
Siebrand Mazeland
79d5225c0e * remove end of line whitespace
* remove empty lines at end of file
* remove "?>" where still present
2008-04-14 07:45:50 +00:00
Daniel Kinzler
715b1aa8f1 added mime type aliases for djvu 2007-09-28 23:02:27 +00:00
Tim Starling
b15d8cffc4 * Introduced media handler modules for file-type specific operations: thumbnailing, img_metadata, capabilities, etc.
* Deprecated $wgUseImageResize, thumbnailing will be enabled unconditionally.
* Fixed interaction of page parameter to ImagePage with the HTML file cache
* Improved error reporting for image thumbnailing
* Fixed MIME type for SVG files, will be silently changed from image/svg to image/svg+xml after loading from the database.
* Workaround for djvutoxml bug #1704049 (poor performance). Use djvudump instead.
* Fixed odd behaviour in ImagePage on DjVu thumbnailing errors
* Improved error reporting for image thumbnailing
* Added sharpening option for ImageMagick thumbnailing
* Removed Image::selectPage(), added page parameters to getWidth() and getHeight(), deprecated Image::renderThumb() and Image::getThumbnail()
* Changed default contents of img_metadata to empty string instead of a:0:{}
* Moved responsibility for respecting $wgGenerateThumbnailOnParse from the UI to Image.php
2007-04-20 12:31:36 +00:00
Daniel Kinzler
db4b8576b8 added image/x-png as an alias for image/png 2007-03-02 12:33:13 +00:00
Daniel Kinzler
d6c831b070 added mime type for FLV files 2007-02-28 17:18:22 +00:00
Brion Vibber
a37467a2df * (bug 5277) Use audio/midi rather that audio/mid 2006-03-30 04:21:01 +00:00
Ævar Arnfjörð Bjarmason
27105c2129 * (bug 898) Mime type autodetection. 2005-05-21 07:46:17 +00:00