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 dependency with mini_mime #789

Merged
merged 2 commits into from May 13, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion google-api-client.gemspec
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'representable', '~> 3.0'
spec.add_runtime_dependency 'retriable', '>= 2.0', '< 4.0'
spec.add_runtime_dependency 'addressable', '~> 2.5', '>= 2.5.1'
spec.add_runtime_dependency 'mime-types', '~> 3.0'
spec.add_dependency 'mini_mime', '>= 0.1.1'
bborn marked this conversation as resolved.
Show resolved Hide resolved
spec.add_runtime_dependency 'signet', '~> 0.10'
spec.add_runtime_dependency 'googleauth', '>= 0.5', '< 0.10.0'
spec.add_runtime_dependency 'httpclient', '>= 2.8.1', '< 3.0'
Expand Down
6 changes: 3 additions & 3 deletions lib/google/apis/core/upload.rb
Expand Up @@ -18,7 +18,7 @@
require 'google/apis/errors'
require 'addressable/uri'
require 'tempfile'
require 'mime-types'
require 'mini_mime'

module Google
module Apis
Expand Down Expand Up @@ -55,8 +55,8 @@ def prepare!
elsif self.upload_source.is_a?(String)
self.upload_io = File.new(upload_source, 'r')
if self.upload_content_type.nil?
type = MIME::Types.of(upload_source)
self.upload_content_type = type.first.content_type unless type.nil? || type.empty?
type = MiniMime.lookup_by_filename(upload_source)
self.upload_content_type = type && type.content_type
end
@close_io_on_finish = true
else
Expand Down