Skip to content

Commit

Permalink
Fix broken processing of incoming e-mail attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtorrent committed Nov 16, 2011
1 parent 03250e0 commit 74d9204
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion app/models/emailer/incoming.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,17 @@ def process_incoming(email)
@body = strip_responses(@body).strip_tags.to_s.strip
@subject = email.subject.to_s.gsub(REPLY_REGEX, "").strip
@files = email.attachments || []


# Format attachments for processing by Paperclip
@files.collect! do |attachment|
file = StringIO.new(attachment.decoded)
file.class.class_eval { attr_accessor :original_filename, :content_type }
file.original_filename = attachment.filename
file.content_type = attachment.mime_type

file
end

Rails.logger.info "#{@user.name} <#{@user.email}> sent '#{@subject}' to #{@to}"
end

Expand Down

0 comments on commit 74d9204

Please sign in to comment.