Project

General

Profile

« Previous | Next » 

Revision c671241f

Added by Marc Dequènes over 14 years ago

  • ID c671241f604047d0ef1941e6ef896ee9969c2543

[fix] corrected multipart MailOrder parsing: skip first part and parse 'content-*' headers properly

View differences:

lib/cyborghood/mail_order.rb
if message.parts[0].content_type == "text/plain"
order_txt = message.parts[0].body
shared_parameters = {}
i = 1
message.parts.each do |p|
shared_parameters[i] = SharedParameter.new(p.body, p.content_type)
filename = p.header['content-type'].params('filename')
shared_parameters[filename] = ParameterReference.new(i) if filename
i = -1
message.parts.each do |part|
i += 1
next if i == 0
shared_parameters[i] = SharedParameter.new(part.body, part.content_type)
filename = part.header['content-disposition'].params['filename'] || part.header['content-type'].params['name']
shared_parameters[filename] = ParameterReference.new(i) if filename
end
end
else

Also available in: Unified diff