Skip to content

Commit ae54a8c

Browse files
authored
Merge pull request #311 from dosuken123/fix-json-api-no-work-with-content_type
Fix JSON API not work with Content type text/plain
2 parents 7c6b63f + 320cdf3 commit ae54a8c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/fog/storage/google_json/requests/put_object.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ def put_object(bucket_name,
4646
kms_key_name: nil,
4747
predefined_acl: nil,
4848
**options)
49-
unless options[:content_type]
50-
if data.is_a?(String)
51-
data = StringIO.new(data)
52-
options[:content_type] = "text/plain"
53-
elsif data.is_a?(::File)
54-
options[:content_type] = Fog::Storage.parse_data(data)[:headers]["Content-Type"]
55-
end
49+
if data.is_a?(String)
50+
data = StringIO.new(data)
51+
options[:content_type] ||= "text/plain"
52+
elsif data.is_a?(::File)
53+
options[:content_type] ||= Fog::Storage.parse_data(data)[:headers]["Content-Type"]
5654
end
5755

5856
# Paperclip::AbstractAdapter

0 commit comments

Comments
 (0)