lib/fog/storage.rb in fog-1.3.0 vs lib/fog/storage.rb in fog-1.3.1
- old
+ new
@@ -55,26 +55,27 @@
else
0
end
end
- def self.parse_data(data)
- metadata = {
- :body => nil,
- :headers => {}
- }
-
- metadata[:body] = data
- metadata[:headers]['Content-Length'] = get_body_size(data)
-
+ def self.get_content_type(data)
if data.respond_to?(:path) and !data.path.nil?
filename = ::File.basename(data.path)
unless (mime_types = MIME::Types.of(filename)).empty?
- metadata[:headers]['Content-Type'] = mime_types.first.content_type
+ mime_types.first.content_type
end
end
- # metadata[:headers]['Content-MD5'] = Base64.encode64(Digest::MD5.digest(metadata[:body])).strip
- metadata
+ end
+
+ def self.parse_data(data)
+ {
+ :body => data,
+ :headers => {
+ 'Content-Length' => get_body_size(data),
+ 'Content-Type' => get_content_type(data)
+ #'Content-MD5' => Base64.encode64(Digest::MD5.digest(metadata[:body])).strip
+ }
+ }
end
def self.providers
Fog.services[:storage]
end