Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
seanpanda0 opened this issue Oct 12, 2022 · 1 comment
Open

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

seanpanda0 opened this issue Oct 12, 2022 · 1 comment

Comments

@seanpanda0
Copy link

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"
@seanpanda0
Copy link
Author

seanpanda0 commented Oct 12, 2022

ok I see #57

and

Invalid, this should be fixed in the shared-mime-info database upstream.
Originally posted by @minad in #57 (comment)

Instead of closing this right away because its invalid, could we create a issue on shared-mime-info and link it here?
Im not seeing an existing one that is obviously related to this issue.

Perhaps: https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/91 but that was closed years ago.

https://freedesktop.org/wiki/Software/shared-mime-info/
https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues

I don't really have the specialty knowledge about detecting file types to really even be confident about creating a ticket on the shared-mime-info database. Otherwise I would do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant