Project

General

Profile

Defect #8093 » msgToEml.patch

Joel Thompson, 2012-08-22 08:12

View differences:

mail_handler2.rb 2012-08-22 16:00:16.234145227 +1000
243 243

  
244 244
  def add_attachments(obj)
245 245
    if email.attachments && email.attachments.any?
246
      email.attachments.each do |attachment|
247
        obj.attachments << Attachment.create(:container => obj,
248
                          :file => attachment.decoded,
249
                          :filename => attachment.filename,
250
                          :author => user,
251
                          :content_type => attachment.mime_type)
246
      email.attachments.each_with_index do |attachment, i|
247
        if attachment.content_type == 'message/rfc822'
248
          attachment.original_filename = "attachments" + i.to_s() + ".eml"
249
          obj.attachments << Attachment.create(:container => obj,
250
                        :file => attachment,
251
                        :author => user,
252
                        :content_type => attachment.content_type)
253
        else
254
          obj.attachments << Attachment.create(:container => obj,
255
                        :file => attachment,
256
                        :author => user,
257
                        :content_type => attachment.content_type)
258
        end
252 259
      end
253 260
    end
254 261
  end
(5-5/8)