fix MailHandler to correctly safe attachments from incomming mails

pull/1186/head
Philipp Tessenow 12 years ago
parent 1285adbdf4
commit 2fe02402ac
  1. 10
      app/models/mail_handler.rb

@ -201,12 +201,14 @@ class MailHandler < ActionMailer::Base
end
def add_attachments(obj)
if email.has_attachments?
if email.attachments && email.attachments.any?
email.attachments.each do |attachment|
Attachment.create(:container => obj,
:file => attachment,
obj.attachments << Attachment.create(
:container => obj,
:file => attachment.decoded,
:filename => attachment.filename,
:author => user,
:content_type => attachment.content_type)
:content_type => attachment.mime_type)
end
end
end

Loading…
Cancel
Save