carrierwaveuploader / carrierwave

Classier solution for file uploads for Rails, Sinatra and other Ruby web frameworks
https://github.com/carrierwaveuploader/carrierwave
8.78k stars 1.66k forks source link

Use Marcel::Magic.new(content_type).extensions instead of Marcel::TYPES[content_type] #2728

Closed schinery closed 9 months ago

schinery commented 9 months ago

This commit of the Marcel gem, which has just shipped in version 1.0.3, breaks Carrierwave as the Marcel::TYPES constant used here has been removed.

This PR is to switch to using Marcel::Magic.new(content_type).extensions to return the extensions and not use constants.

schinery commented 9 months ago

Not sure why, but this PR is getting the following failure in the ruby-head tests for ./spec/processing/rmagick_spec.rb:248.

expected NoMethodError with message matching /private method `foo=' called/, got #<NoMethodError: private method 'foo=' called for an instance of Magick::Image::Info> with backtrace:

Doesn't seem to be related to these changes, but flagging anyway.

BrianHawley commented 9 months ago

@schinery the test failure in ruby-head is because of https://bugs.ruby-lang.org/issues/16495

In spec/processing/rmagick_spec.rb line 258, change:

/private method `foo=' called/

to:

/private method .foo=. called/

That will handle the quoting change.

schinery commented 9 months ago

@BrianHawley that did the trick 👍🏻

bvogel commented 9 months ago

I would vote not not move from one private constant to another

bvogel commented 9 months ago

Nice work everyone!

mshibuya commented 9 months ago

Thank you for the fix!

bvogel commented 9 months ago

@mshibuya any chance for a new release soon?