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

Replace mime-types gem with mini_mime #1695

Merged
merged 1 commit into from
Jan 11, 2023
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo

### Changed
* Update dependency cucumber-gherkin to v26 ([#1688](https://github.com/cucumber/cucumber-ruby/pull/1688))
* Replace dependency [mime-types](https://rubygems.org/gems/mime-types)
with [mini_mime](https://rubygems.org/gems/mini_mime)
([#1695](https://github.com/cucumber/cucumber-ruby/pull/1695))

### Deprecated

Expand Down
2 changes: 1 addition & 1 deletion cucumber.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Gem::Specification.new do |s|
s.add_dependency 'cucumber-html-formatter', '>= 19.1', '< 21.0'
s.add_dependency 'cucumber-messages', '>= 18', '< 22'
s.add_dependency 'diff-lcs', '~> 1.5', '>= 1.5.0'
s.add_dependency 'mime-types', '~> 3.4', '>= 3.4.1'
s.add_dependency 'mini_mime', '~> 1.0'
s.add_dependency 'multi_test', '~> 1.1', '>= 1.1.0'
s.add_dependency 'sys-uname', '~> 1.2', '>= 1.2.2'

Expand Down
4 changes: 2 additions & 2 deletions lib/cucumber/glue/proto_world.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'cucumber/gherkin/formatter/ansi_escapes'
require 'cucumber/core/test/data_table'
require 'cucumber/deprecate'
require 'mime/types'
require 'mini_mime'

module Cucumber
module Glue
Expand Down Expand Up @@ -92,7 +92,7 @@ def attach(file, media_type = nil)
return super unless File.file?(file)

content = File.read(file, mode: 'rb')
media_type = MIME::Types.type_for(file).first if media_type.nil?
media_type = MiniMime.lookup_by_filename(file)&.content_type if media_type.nil?
luke-hill marked this conversation as resolved.
Show resolved Hide resolved

super(content, media_type.to_s)
rescue StandardError
Expand Down