Skip to content

MimeMagic.by_magic returns nil for .txt text/plain files #169

@seanpanda0

Description

@seanpanda0

Im on mac and I did install the shared-mime-info via brew.

currently It is returning nil for plain text file.
I expect it to return text/plain.

$ ruby --version
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-darwin21] 
$ file --mime-type sample.txt
sample.txt: text/plain
$ file --mime-type sample.png
sample.png: image/png

irb

> require 'mimemagic'
 => true
> MimeMagic::VERSION
 => "0.4.3"
> MimeMagic.by_magic(File.open('sample.txt'))&.type
 => nil
> MimeMagic.by_magic(File.open('sample.png'))&.type
 => "image/png"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions