rails / marcel

Find the mime type of files, examining file, filename and declared type
Apache License 2.0
386 stars 67 forks source link

Documentation is misleading #78

Closed akimd closed 8 months ago

akimd commented 2 years ago

The README reads:

If this doesn't work, it uses the type gleaned from the filename, extension, and finally the declared type.

But the code is

fallback_type = for_declared_type(declared_type) || for_name(name) || for_extension(extension) || BINARY

so clearly the declared type is not checked last.

Which is unfortunate for my use case, so actually maybe the documentation is right wrt the intentions, but the code is wrong?

jeremy commented 8 months ago

Yep, that's wrong. Updated the heuristic in https://github.com/rails/marcel/commit/2bbfd78cd30c5c3c9f17059aeb01797bd86807fd

akimd commented 8 months ago

Very clear addition to the documentation, thanks a lot!