JPEG2000 images should not be uploadable as .jpg files
Closed, ResolvedPublic

Description

Rolling this out of bug 11871, which was asking for _support_ for JPEG 2000 images. Since they're not widely supported by browsers and they're a lossy format without a clear benefit to use I'm WONTFIXing that for now, but the upload bug that makes it possible to mistakenly upload them remains.

http://commons.wikimedia.org/wiki/Image:VIC_2_SECTION_%28Converted%29-1.jpg
is an example of a file that was first uploaded as JPEG 2000 (the current version was correctly converted to regular JPEG).

http://test.wikipedia.org/wiki/File:A_JPEG_2000_file.jpg
is an example mentioned also on the previous bug which I reuploaded to test to confirm the bug is still present.

File file type is being detected as image/jp2, but this shouldn't make it past upload since it shouldn't match '.jpg' file extension...


Version: unspecified
Severity: enhancement
URL: http://commons.wikimedia.org/wiki/Image:VIC_2_SECTION_%28Converted%29-1.jpg

bzimport added a project: MediaWiki-Uploading.Via ConduitNov 21 2014, 10:37 PM
bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz18803.
brion created this task.Via LegacyMay 15 2009, 12:13 AM
Tgr added a comment.Via ConduitMay 15 2009, 3:47 PM

Probably a more general bug, for example [[hu:File:China.ogg]] is an mp3 file with .ogg extension.

bzimport added a comment.Via ConduitMay 15 2009, 7:30 PM

ahmad.m.sherif wrote:

proposed patch

(In reply to comment #0)

File file type is being detected as image/jp2, but this shouldn't make it past
upload since it shouldn't match '.jpg' file extension...

I think this is because there is no mime type entry for jpeg2000 format in mime.types file. I made a patch anyway.

(In reply to comment #1)

Probably a more general bug, for example [[hu:File:China.ogg]] is an mp3 file
with .ogg extension.

IMHO, this is because 'audio/mp3' is the main mime type in mime.info and we use 'audio/mpeg' in mime.types instead of it, so MimeMagic::isMatchingExtension() returns NULL (which means continue) instead of false. It only needs a switch in one of the files.

Attached: jpg2000.patch

brion added a comment.Via ConduitMay 15 2009, 9:20 PM

That should mean you can never upload those files at all, if they're unrecognized they can't match the known extension type...

bzimport added a comment.Via ConduitMay 14 2011, 2:42 PM

Bryan.TongMinh wrote:

Added the entries to mime.types and mime.info in r88086.

Gilles added a project: Multimedia.Via WebDec 4 2014, 10:54 AM
Gilles moved this task to Closed on the Multimedia workboard.Via WebDec 4 2014, 10:59 AM
reubot added a subscriber: reubot.Via WebFeb 14 2015, 12:25 PM

Add Comment