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

Do not return unexpected false for content type when file is deleted #2384

Merged
merged 1 commit into from Apr 30, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/carrierwave/storage/fog.rb
Expand Up @@ -218,7 +218,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