Empty email attachments are imported to Redmine, creating broken DB records (#27885).

Patch by Felix Schäfer.

git-svn-id: http://svn.redmine.org/redmine/trunk@17147 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2018-01-07 21:46:58 +00:00
parent 2cb30321a2
commit 4e6b54e33e
3 changed files with 67 additions and 0 deletions

View File

@@ -296,6 +296,7 @@ class MailHandler < ActionMailer::Base
if email.attachments && email.attachments.any?
email.attachments.each do |attachment|
next unless accept_attachment?(attachment)
next unless attachment.body.decoded.size > 0
obj.attachments << Attachment.create(:container => obj,
:file => attachment.body.decoded,
:filename => attachment.filename,