From 162b8401008b9a9a111a32187a20f494858ab84b Mon Sep 17 00:00:00 2001 From: Beowulf Date: Sun, 28 Apr 2024 00:33:03 +0200 Subject: [PATCH] Add inline attachments to comments If incoming email is configured and an email is sent, inline attachments are currently not added to the comment if it has the `Content-Disposition: inline` instead of `Content-Disposition: attachment` as e.g. with Apple Mail. This adds inline attachments (`Content-Disposition: inline`) that have a filename as attachment to the comment. Fixes #3496 --- services/mailer/incoming/incoming.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/mailer/incoming/incoming.go b/services/mailer/incoming/incoming.go index eade0cf271..a2352773ae 100644 --- a/services/mailer/incoming/incoming.go +++ b/services/mailer/incoming/incoming.go @@ -367,6 +367,14 @@ func getContentFromMailReader(env *enmime.Envelope) *MailContent { Content: attachment.Content, }) } + for _, inline := range env.Inlines { + if inline.FileName != "" { + attachments = append(attachments, &Attachment{ + Name: inline.FileName, + Content: inline.Content, + }) + } + } return &MailContent{ Content: reply.FromText(env.Text),