diff --git a/lib/dragonfly/s3_data_store.rb b/lib/dragonfly/s3_data_store.rb index bd3e3d4..33ae31f 100644 --- a/lib/dragonfly/s3_data_store.rb +++ b/lib/dragonfly/s3_data_store.rb @@ -136,12 +136,15 @@ def full_storage_headers(headers, meta) end def headers_to_meta(headers) + meta = {} json = headers['x-amz-meta-json'] if json && !json.empty? - unescape_meta_values(Serializer.json_decode(json)) + meta.merge(unescape_meta_values(Serializer.json_decode(json))) elsif marshal_data = headers['x-amz-meta-extra'] - Utils.stringify_keys(Serializer.marshal_b64_decode(marshal_data)) + meta.merge(Utils.stringify_keys(Serializer.marshal_b64_decode(marshal_data))) end + meta['mime_type'] ||= headers['Content-Type'] if headers.key?('Content-Type') + meta end def meta_to_headers(meta)