discourse / mini_mime

minimal mime type library
MIT License
95 stars 34 forks source link

Using non-standard mimes #23

Closed gmcgibbon closed 5 years ago

gmcgibbon commented 5 years ago

Seeing how with mime-types you can do MIME::Types.add(some_new_type) to add non-standard mimes, does this gem have any plans on supporting this feature in some way?

jeremy commented 5 years ago

No plans, as the lib is designed for use with static db files fronted by a small memory cache. Could investigate supporting this though, e.g. by allowing you to

Retaining perf and resource consumptioin characteristics for mainline usage is important though.

gmcgibbon commented 5 years ago

Right, I was thinking of providing an API to point to custom db files to check when the primary db doesn't have a definition. That way only custom cases should be affected. I'll see if I can prototype something and PR it.

SamSaffron commented 5 years ago

sure, but I really don't want to suffer any perf hit here for the extra flexibility here. Maybe have a place you call upfront to point it at a different set of DB files, then you would override the location of the DBs after you require the gem.

Also, super curious for an actual example here of the problem mime type, is the root issue that the mime type gem is slow to accept new mime types?

gmcgibbon commented 5 years ago

Maybe have a place you call upfront to point it at a different set of DB files, then you would override the location of the DBs after you require the gem.

Sure, I haven't started yet so I can go for that approach instead if we think it's better.

is the root issue that the mime type gem is slow to accept new mime types?

No, its mainly because I'm not comfortable upstreaming the MIME changes in our app because I think some of them are wrong. We treat *.sass and *.scss as text/css and support *.liquid, which doesn't have an official content type. I considered upstreaming the liquid MIME but there's a debate as to what the content type should actually be.