lib/property/parse_file.rb in dm-parse-0.2.2 vs lib/property/parse_file.rb in dm-parse-0.2.3
- old
+ new
@@ -4,14 +4,14 @@
class ParseFile < Object
def dump(value)
if value.is_a?(Hash)
value.merge("__type" => "File")
- elsif value.respond_to?(:original_filename) && value.respond_to?(:read)
+ elsif value.respond_to?(:original_filename) && value.respond_to?(:read) && value.respond_to?(:content_type)
adapter = model.repository.adapter
filename = value.original_filename
content = value.read
- content_type = MIME::Types.type_for(filename).first
+ content_type = value.content_type
dump adapter.upload_file(filename, content, content_type)
else
nil
end
end