mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 10:41:25 +08:00
FIX: properly handle attachments in received emails
This regressed in 1ac3e547 when we added support for eml attachments.
This commit is contained in:
@ -931,18 +931,20 @@ module Email
|
||||
end
|
||||
|
||||
def attachments
|
||||
# strip blacklisted attachments (mostly signatures)
|
||||
@attachments ||= begin
|
||||
attachments = @mail.parts.select { |part| part.attachment? && is_whitelisted_attachment?(part) }
|
||||
attachments = @mail.attachments.select { |attachment| is_whitelisted_attachment?(attachment) }
|
||||
attachments << @mail if @mail.attachment? && is_whitelisted_attachment?(@mail)
|
||||
|
||||
@mail.parts.each do |part|
|
||||
attachments << part if part.attachment? && is_whitelisted_attachment?(part)
|
||||
end
|
||||
|
||||
attachments
|
||||
end
|
||||
end
|
||||
|
||||
def create_post_with_attachments(options = {})
|
||||
# deal with attachments
|
||||
options[:raw] = add_attachments(options[:raw], options[:user], options)
|
||||
|
||||
create_post(options)
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user