Project

General

Profile

Feature #3413 » mail_handler_ignore_inline_attachments_patch.diff

v2 - Egidijus Zideckas, 2012-11-20 09:49

View differences:

app/models/mail_handler.rb
248 248

  
249 249
  def add_attachments(obj)
250 250
    if email.attachments && email.attachments.any?
251
      email.attachments.each do |attachment|
252
        obj.attachments << Attachment.create(:container => obj,
253
                          :file => attachment.decoded,
254
                          :filename => attachment.filename,
255
                          :author => user,
256
                          :content_type => attachment.mime_type)
257
      end
251
        email.attachments.each do |attachment|
252
          if attachment.header.to_s.match(/Content-Disposition: attachment;/)
253
            obj.attachments << Attachment.create(:container => obj,
254
                              :file => attachment.decoded,
255
                              :filename => attachment.filename,
256
                              :author => user,
257
                              :content_type => attachment.mime_type)
258
          else
259
            logger.info "MailHandler:  ignoring signature attachment #{attachment.filename} " if logger && logger.info
260
          end
261
        end
258 262
    end
259 263
  end
260 264

  
(3-3/3)