Skip to content
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

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

Merged
merged 4 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/carrierwave/downloader/remote_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def headers

def original_filename
filename = filename_from_header || filename_from_uri
mime_type = Marcel::TYPES[content_type]
unless File.extname(filename).present? || mime_type.blank?
extension = mime_type[0].first
extensions = Marcel::Magic.new(content_type).extensions
unless File.extname(filename).present? || extensions.blank?
extension = extensions.first
filename = "#{filename}.#{extension}"
end
filename
Expand Down
2 changes: 1 addition & 1 deletion spec/processing/rmagick_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def foo=(value); raise; end
instance.manipulate! :read => {
:foo => "1"
}
end.to raise_error NoMethodError, /private method `foo=' called/
end.to raise_error NoMethodError, /private method .foo=. called/
end
end

Expand Down