Microsoft Office 2007+ formats (xlsx, docx, and pptx) are not supported by the mime database at freedesktop.org. These files are all zipped collections of xml files and will be detected as "application/zip". Mimemagic comes with extra magic you can overlay on top of the defaults to correctly detect these file types. Enable it like this:
Microsoft Office 2007+ formats (xlsx, docx, and pptx) are not supported by the mime database at freedesktop.org. These files are all zipped collections of xml files and will be detected as "application/zip". Mimemagic comes with extra magic you can overlay on top of the defaults to correctly detect these file types. Enable it like this:
require 'mimemagic'
```ruby
require 'mimemagic/overlay'
require'mimemagic'
MimeMagic.by_magic(File.open('test.xlsx'))
require'mimemagic/overlay'
MimeMagic.by_magic(File.open('test.xlsx'))
```
You can add your own magic with `MimeMagic.add`. See `lib/mimemagic/overlay.rb`.
You can add your own magic with `MimeMagic.add`. See `lib/mimemagic/overlay.rb`.