https://bugzilla.wikimedia.org/show_bug.cgi?id=63584

Bawolff (Brian Wolff) <bawolff...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aarcos.w...@gmail.com,
                   |                            |bawolff...@gmail.com,
                   |                            |fflo...@wikimedia.org,
                   |                            |gti...@wikimedia.org,
                   |                            |mtrac...@member.fsf.org
          Component|API                         |File management
            Summary|API responds with           |False positives for
                   |"mediatype": "VIDEO" for an |MEDIATYPE_VIDEO due to
                   |audio file                  |looking for string theora
                   |                            |in (audio) ogg files

--- Comment #1 from Bawolff (Brian Wolff) <bawolff...@gmail.com> ---
Wow is the code to determine media type ever hacky...

We determine if the media type is VIDEO, by seeing if the word theora appears
in the first 256 bytes of the file (MimeMagic::getMediaType). In this case, the
file begins with:

00000000  4f 67 67 53 00 02 00 00  00 00 00 00 00 00 ea 37  |OggS...........7|
00000010  77 5a 00 00 00 00 32 03  54 97 01 1e 01 76 6f 72  |wZ....2.T....vor|
00000020  62 69 73 00 00 00 00 02  44 ac 00 00 00 00 00 00  |bis.....D.......|
00000030  80 38 01 00 00 00 00 00  b8 01 4f 67 67 53 00 00  |.8........OggS..|
00000040  00 00 00 00 00 00 00 00  ea 37 77 5a 01 00 00 00  |.........7wZ....|
00000050  c2 13 86 6c 0f 4b ff ff  ff ff ff ff ff ff ff ff  |...l.K..........|
00000060  ff ff ff a9 03 76 6f 72  62 69 73 1d 00 00 00 58  |.....vorbis....X|
00000070  69 70 68 2e 4f 72 67 20  6c 69 62 56 6f 72 62 69  |iph.Org libVorbi|
00000080  73 20 49 20 32 30 30 37  30 36 32 32 01 00 00 00  |s I 20070622....|
00000090  1a 00 00 00 45 4e 43 4f  44 45 52 3d 66 66 6d 70  |....ENCODER=ffmp|
000000a0  65 67 32 74 68 65 6f 72  61 2d 30 2e 32 33 01 05  |eg2theora-0.23..|
000000b0  76 6f 72 62 69 73 21 42  43 56 01 00 00 01 00 18  |vorbis!BCV......|
000000c0  63 54 29 46 99 52 d2 4a  89 19 73 94 31 46 99 62  |cT)F.R.J..s.1F.b|
[...]

So the vorbis comment that the encoder is ffmpeg2theora-0.23 triggers MediaWiki
to think the file is a video as the word "theora" appears at the beginning of
the file.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to