We're missing mimetype support for some popular e-book formats:
Amazon Kindle (.azw) = application/vnd.amazon.ebook
EPub (.epub) = application/epub+zip
MobiPocket (.prc, .mobi) = application/x-mobipocket-ebook
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | after.png | 26.03 KB | dcam |
| #25 | file-ebook-mime-types-144307-d7-filelist.png | 12.03 KB | ByronNorris |
| #25 | file-ebook-mime-types-144307-d7-file-managed-table.png | 52.05 KB | ByronNorris |
| #25 | file-ebook-mime-types-1443070-25.patch | 2.91 KB | ByronNorris |
| #11 | Screen Shot 2012-07-26 at 2.10.39 PM.png | 55.48 KB | saltednut |
Comments
Comment #1
becw commentedComment #2
becw commentedI'm going to leave this for someone who's new to core development :)
Comment #3
crashtest_ commentedComment #4
crashtest_ commentedAdded the above mimetypes.
Comment #5
dave reidLet's not have three separate file mime type issues open because they will naturally conflict with each other. Let's merge #1293140: Add support for mkv and mka file extensions and #1347624: Add support for the Google web file types: weba, webm, and webp into this issue and let CrashTest_ at it!
Comment #6
dave reidFor reference:
File extension: mkv
Mime type: video/x-matroska
File extension: mka
Mime type: audio/x-matroska
File extension: .webp
Mime type: image/webp
File extension: .weba
Mime type: audio/webm
File extension: .webm
Mime type: video/webm
File extension: vtt
Mime type: text/vtt
Comment #7
crashtest_ commentedAdding the other two extensions from very similar issue: http://drupal.org/node/1293140 - add support for mka and mkv.
Comment #8
dave reidComment #9
dave reidAdding backport tag.
Comment #10
crashtest_ commentedAdded support for the following extensions:
+ 'azw' => 349,
+ 'epub' => 350,
+ 'mobi' => 351,
+ 'prc' => 352,
+ 'mkv' => 353,
+ 'mka' => 354,
+ 'webp' => 355,
+ 'weba' => 356,
+ 'webm' => 357,
+ 'vtt' => 358,
Comment #11
saltednut#10 applies cleanly. Tested using 10 files with the extensions in question.
Here are a couple of screenshots showing the new mimetypes at work:
Comment #12
catchAny reason why these are being added with out of sequence array indices?
Let's re-number the array instead of putting out of sequence array indices.
Comment #13
dave reidIf we want to re-order them to not be alphabetical, then we should probably file that as a follow-up. Ordering them in alphabetically is wonky, but it does make sense, and it's how we've been extending this list so far. It also makes the mime types easier to find when doing a visual scan.
See: http://api.drupal.org/api/drupal/core%21includes%21file.mimetypes.inc/fu...
I think this should still be RTBC to get it in, and re-order if we want to afterwards.
Comment #14
catchWe should just re-index the array - i.e. have it both alphabetical, and the numeric keys in sequence. That will mean the index changes for some file types but that should be a problem since code shouldn't be dealing with the indexes directly anyway.
I don't see a reason not to fix that before this goes in, the fact that another patch already made it wonky doesn't feel like a reason to make it even worse.
Comment #15
albert volkman commentedI'm not entirely familiar with the usage here, but if the code should never deal with the indexes directly, then why do we have them? Could we just do away with them entirely?
Comment #16
dave reidComment #17
dave reidI would much rather list our extensions and mime types using the following:
catch do you think this is better? If so I'm ok with refactoring this function to use this syntax for D8 as a blocker to this issue.
Comment #18
Jorrit commentedIs it possible to have patch #10 applied to Drupal 8 and backported to 7 before this refactoring process is started? Or just to Drupal 7?
Comment #19
dave reid#10: file-ebook-mime-types-1443070-6278594.patch queued for re-testing.
Comment #20
dave reidI must insist that we follow-up with cleaning up the list in a separate issue because that itself would not be backported to Drupal 7.
Comment #21
dave reidNormal priority follow-up task filed to #2067243: Cleanup and re-order file_default_mimetype_mapping() mappings
Comment #22
catchI think we could backport a re-numbering of the array to D7, assigning to David for comment.
Comment #23
David_Rothstein commentedWell, if my reading of hook_file_mimetype_mapping_alter() is correct, those numbers are actually meaningful (people are intended to refer to them directly in the alter hook, as in the example code used there)... If that's the case, we shouldn't renumber them in Drupal 7.
Comment #24
alexpottThere is precedence for adding mimetypes out of order see #370958: FLV Flash Video Mimetypes. I don't think we should get to hung up on the order of the array - preserving the numbers for existing code seems more in our interests.
Committed fc4150b and pushed to 8.x. Thanks!
Comment #25
ByronNorris commentedUploading D7 backport containing the mimetypes from ExtensionMimeTypeGuesser.php in 8.x branch. List remains out of order. Screenshots attached of the new mimetypes working properly.
Comment #26
dcam commentedLooks good to me. RTBC.

Comment #29
dcam commentedComment #32
dcam commentedComment #35
dcam commentedComment #38
dcam commentedComment #41
dcam commentedComment #42
David_Rothstein commentedCommitted to 7.x - thanks!