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
Remove CarrierWave::MimeTypes
processor module
#1813
Remove CarrierWave::MimeTypes
processor module
#1813
Conversation
I'm happy to remove this processor module. It's clearly deprecated, and offers very little. |
I'd welcome a PR that removed the need for |
b80b8a3
to
2fc9ed3
Compare
@thomasfedb thanks for your feedback. I'll work on removing MagicMime then 👍 |
Since carrierwaveuploader#1245 (*), CarrierWave::MimeTypes module is redundant as `mime-types` gem is a runtime dependency now, and `SanitizedFile` gets it's content_type using it. The module was deprecated since 0.10 and warned developers when used it. (*) I discovered this when tried to fix specs marked as pending. I looked at commits history and PRs to understand what happened. It started with carrierwaveuploader#372 that added `CarrierWave::MimeTypes` processor (Jun 2011), then carrierwaveuploader#1216 and carrierwaveuploader#1245 that made `mime-types` a runtime dependency and deprecated `CarrierWave::MimeTypes` module (2013), and finally carrierwaveuploader#1584 `CarrierWave::MagicMimeTypes` (2015)
2fc9ed3
to
947eee5
Compare
See carrierwaveuploader#1813 for background.
Before this, CarrierWave was relying on mime-types or ruby-filemagic gems to get/set the content type of a file in an inconsistent way. After making mime-types a runtime dependency for CW, `CarrierWave::MimeTypes` has been dropped (carrierwaveuploader#1813 for details), and `CarrierWave::MagicMimeTypes` as well. White/blacklisting content types feature was relying only on ruby-filemagic to read the content type of a file. It was optional and required mixing a module to the uploader. This commit remove this dependency by using the already available content type (thanks to `Mime::Types`). This let us drop any dependency on ruby-filemagic in CarrierWave. It makes JRuby support better as ruby-filemagic is unsupported on JRuby due to the C extension.
Before this, CarrierWave was relying on mime-types or ruby-filemagic gems to get/set the content type of a file in an inconsistent way. After making mime-types a runtime dependency for CW, `CarrierWave::MimeTypes` has been dropped (carrierwaveuploader#1813 for details), and `CarrierWave::MagicMimeTypes` as well. White/blacklisting content types feature (introduced by carrierwaveuploader#1596) was relying only on ruby-filemagic to read the content type of a file. It was optional and required mixing a module to the uploader. This commit removes this dependency by using the already available content type (thanks to `Mime::Types`). This let us drop any dependency on ruby-filemagic in CarrierWave. It makes JRuby support better as ruby-filemagic is unsupported on JRuby due to the C extension.
@thomasfedb I removed the need of |
Before this, CarrierWave was relying on mime-types or ruby-filemagic gems to get/set the content type of a file in an inconsistent way. After making mime-types a runtime dependency for CW, `CarrierWave::MimeTypes` has been dropped (carrierwaveuploader#1813 for details), and `CarrierWave::MagicMimeTypes` as well. White/blacklisting content types feature (introduced by carrierwaveuploader#1596) was relying only on ruby-filemagic to read the content type of a file. It was optional and required mixing a module to the uploader. This commit removes this dependency by using the already available content type (thanks to `Mime::Types`). This let us drop any dependency on ruby-filemagic in CarrierWave. It makes JRuby support better as ruby-filemagic is unsupported on JRuby due to the C extension.
Remove depreciated CarrierWave::MimeTypes processor
See carrierwaveuploader#1813 for background.
Before this, CarrierWave was relying on mime-types or ruby-filemagic gems to get/set the content type of a file in an inconsistent way. After making mime-types a runtime dependency for CW, `CarrierWave::MimeTypes` has been dropped (carrierwaveuploader#1813 for details), and `CarrierWave::MagicMimeTypes` as well. White/blacklisting content types feature (introduced by carrierwaveuploader#1596) was relying only on ruby-filemagic to read the content type of a file. It was optional and required mixing a module to the uploader. This commit removes this dependency by using the already available content type (thanks to `Mime::Types`). This let us drop any dependency on ruby-filemagic in CarrierWave. It makes JRuby support better as ruby-filemagic is unsupported on JRuby due to the C extension.
See carrierwaveuploader#1813 for background.
Before this, CarrierWave was relying on mime-types or ruby-filemagic gems to get/set the content type of a file in an inconsistent way. After making mime-types a runtime dependency for CW, `CarrierWave::MimeTypes` has been dropped (carrierwaveuploader#1813 for details), and `CarrierWave::MagicMimeTypes` as well. White/blacklisting content types feature (introduced by carrierwaveuploader#1596) was relying only on ruby-filemagic to read the content type of a file. It was optional and required mixing a module to the uploader. This commit removes this dependency by using the already available content type (thanks to `Mime::Types`). This let us drop any dependency on ruby-filemagic in CarrierWave. It makes JRuby support better as ruby-filemagic is unsupported on JRuby due to the C extension.
Before this, CarrierWave was relying on mime-types or ruby-filemagic gems to get/set the content type of a file in an inconsistent way. After making mime-types a runtime dependency for CW, `CarrierWave::MimeTypes` has been dropped (carrierwaveuploader#1813 for details), and `CarrierWave::MagicMimeTypes` as well. White/blacklisting content types feature (introduced by carrierwaveuploader#1596) was relying only on ruby-filemagic to read the content type of a file. It was optional and required mixing a module to the uploader. This commit removes this dependency by using the already available content type (thanks to `Mime::Types`). This let us drop any dependency on ruby-filemagic in CarrierWave. It makes JRuby support better as ruby-filemagic is unsupported on JRuby due to the C extension.
See carrierwaveuploader#1813 for background.
Before this, CarrierWave was relying on mime-types or ruby-filemagic gems to get/set the content type of a file in an inconsistent way. After making mime-types a runtime dependency for CW, `CarrierWave::MimeTypes` has been dropped (carrierwaveuploader#1813 for details), and `CarrierWave::MagicMimeTypes` as well. White/blacklisting content types feature (introduced by carrierwaveuploader#1596) was relying only on ruby-filemagic to read the content type of a file. It was optional and required mixing a module to the uploader. This commit removes this dependency by using the already available content type (thanks to `Mime::Types`). This let us drop any dependency on ruby-filemagic in CarrierWave. It makes JRuby support better as ruby-filemagic is unsupported on JRuby due to the C extension.
See carrierwaveuploader#1813 for background.
Before this, CarrierWave was relying on mime-types or ruby-filemagic gems to get/set the content type of a file in an inconsistent way. After making mime-types a runtime dependency for CW, `CarrierWave::MimeTypes` has been dropped (carrierwaveuploader#1813 for details), and `CarrierWave::MagicMimeTypes` as well. White/blacklisting content types feature (introduced by carrierwaveuploader#1596) was relying only on ruby-filemagic to read the content type of a file. It was optional and required mixing a module to the uploader. This commit removes this dependency by using the already available content type (thanks to `Mime::Types`). This let us drop any dependency on ruby-filemagic in CarrierWave. It makes JRuby support better as ruby-filemagic is unsupported on JRuby due to the C extension.
Just wanted to thank @mehlah for going through the extra effort of researching and documenting the history of |
Thanks @earksiinni for the kind words ;) |
According the README and changelog these are now optional - the changelog is automatically inferred. It's hard to reference specific commits, but this MR removed it [1]. [1] carrierwaveuploader/carrierwave#1813
The method has been removed, and according to the README and changelog it is longer necessary to set the content type manually - it is automatically inferred. It's hard to reference specific commits, but this MR removed it: [1]. [1] carrierwaveuploader/carrierwave#1813 Co-authored-by: Tom Levy <tomlevy93@gmail.com>
Since #1245 (*), CarrierWave::MimeTypes module is redundant as
mime-types
gem is a runtime dependency now, andSanitizedFile
gets it's content_type using it.The module was deprecated since 0.10 and warned developers when used it.
What do you think about removing MagicMimeTypes processor module too?
I can't see any valid reason to keep it around.
A related side note: CarrierWave rely on ruby-filemagic gem (
MagicMime
) to validates the content type of a file against a white/blacklist.I think we should use mime-types (
Mime::Types
) for this as it's a runtime dependency, and it's consistent with what it's used bySanitizedFile
to set a content type.Otherwise, we could use
MagicMime
everywhere as a runtime dependency instead ofMime::Types
, but this kills JRuby support.(*) I discovered this when tried to fix specs marked as pending. I looked at commits history and PRs to understand what happened.
It started with #372 that added
CarrierWave::MimeTypes
processor (Jun 2011), then #1216 and #1245 that mademime-types
a runtime dependency and deprecatedCarrierWave::MimeTypes
module (2013), and finally #1584CarrierWave::MagicMimeTypes
(2015)