Skip to content

Commit

Permalink
Replace mime-types dependency with mini_mime (#1695)
Browse files Browse the repository at this point in the history
  • Loading branch information
orien authored Jan 11, 2023
1 parent cd5f138 commit 85064d6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
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?

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

0 comments on commit 85064d6

Please sign in to comment.