Mimetype validation incorrectly identifies .xls files as application/x-ole-storage

When I run file --mime-type sample.xls from the terminal it reports the mimetype as: ‘application/’. Whereas Shrine describes the mimetype as ‘application/x-ole-storage’.

Im not sure what I’m doing wrong here. Here’s my uploader:

class AttachmentUploader < Shrine

  MAX_SIZE = 50*1024*1024

  plugin :remove_attachment
  plugin :validation_helpers
  plugin :determine_mime_type, analyzer: :marcel

  Attacher.validate do
    puts get.mime_type
    validate_mime_type FileType.pluck(:mimetype)
    validate_size 0..MAX_SIZE


I had a similar problem. Looks like it’s an issue in mimemagic.

I can’t post a link. But see “issue 50” on the mimemagic github repo for some workarounds. The patch from dukz certainly worked for me.