Skip to content

Commit

Permalink
Merge pull request #2384 from longkt90/master
Browse files Browse the repository at this point in the history
Do not return unexpected false for content type when file is deleted
  • Loading branch information
mshibuya committed Apr 30, 2019
2 parents 2aaaedf + aefc577 commit 65fa873
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/carrierwave/storage/fog.rb
Expand Up @@ -216,7 +216,7 @@ def authenticated_url(options = {})
# [String] value of content-type
#
def content_type
@content_type || !file.nil? && file.content_type
@content_type || file&.content_type
end

##
Expand Down
4 changes: 2 additions & 2 deletions spec/storage/fog_helper.rb
Expand Up @@ -251,8 +251,8 @@ class FogSpec#{fog_credentials[:provider]}Uploader < CarrierWave::Uploader::Base
expect { @fog_file.size }.not_to raise_error
end

it "should not error getting the content type" do
expect { @fog_file.content_type }.not_to raise_error
it "should return a string or nil for content type" do
expect { @fog_file.content_type&.size }.not_to raise_error
end
end
end
Expand Down

0 comments on commit 65fa873

Please sign in to comment.