blackwinter / ruby-filemagic

Ruby bindings to the magic(4) library, revised.
https://blackwinter.github.iom/ruby-filemagic
146 stars 34 forks source link

`content_type` broken in 0.6.0 #7

Closed amw closed 10 years ago

amw commented 10 years ago

I get the following error when calling file.content_type on 0.6.0. It works fine with the same file on 0.5.0.

>> f.content_type
TypeError: wrong argument type Hash (expected Fixnum or Symbol)
    from /usr/local/Cellar/ruby/2.1.2/lib/ruby/gems/2.1.0/gems/ruby-filemagic-0.6.0/lib/filemagic.rb:56:in `flags'
    from /usr/local/Cellar/ruby/2.1.2/lib/ruby/gems/2.1.0/gems/ruby-filemagic-0.6.0/lib/filemagic.rb:56:in `fm'
    from /usr/local/Cellar/ruby/2.1.2/lib/ruby/gems/2.1.0/gems/ruby-filemagic-0.6.0/lib/filemagic/ext.rb:63:in `file_type'
    from /usr/local/Cellar/ruby/2.1.2/lib/ruby/gems/2.1.0/gems/ruby-filemagic-0.6.0/lib/filemagic/ext.rb:24:in `mime_type'
    from /usr/local/Cellar/ruby/2.1.2/lib/ruby/gems/2.1.0/gems/ruby-filemagic-0.6.0/lib/filemagic/ext.rb:31:in `content_type'
    from /usr/local/Cellar/ruby/2.1.2/lib/ruby/gems/2.1.0/gems/ruby-filemagic-0.6.0/lib/filemagic/ext.rb:51:in `content_type'
    from (irb):2
    from /usr/local/Cellar/ruby/2.1.2/lib/ruby/gems/2.1.0/gems/railties-3.2.19/lib/rails/commands/console.rb:47:in `start'
    from /usr/local/Cellar/ruby/2.1.2/lib/ruby/gems/2.1.0/gems/railties-3.2.19/lib/rails/commands/console.rb:8:in `start'
    from /usr/local/Cellar/ruby/2.1.2/lib/ruby/gems/2.1.0/gems/railties-3.2.19/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
blackwinter commented 10 years ago

Thanks! It's fixed in version 0.6.1.

amw commented 10 years ago

That was quick. Thanks!