Problem
CarrierWave::MimeTypes
, which added the set_content_type
method to an uploader is deprecated. Among other things, this method would attempt to detect the content type if the given one was generic (either application/octet-stream
or binary/octet-stream
).
The deprecation message for CarrierWave::MimeTypes
says:
get the content_type from the SanitizedFile object directly
However this class always returns the existing content type if it is defined whether it is generic or not. See the code here.
Current Solution
For now we're manually handling this by clearing the content type if it is a generic type and having the library then properly detect it. We could set it ourselves with a call to ::MIME::Types.type_for
however we're attempting to keep our code as upgrade compatible as we can.
Question / tl;dr
Is there a best practice for handling CarrierWave uploads with generic content types (application/octet-stream
) now that CarrierWave::MimeTypes
is deprecated?