mirror of
1
Fork 0
forgejo/services/mailer/incoming
christopher-besch 3de904c963 feat: parse inline attachments for incoming mail (#7136)
- Some email clients send inline attachments using the `multipart/related` Mime-Type and enmime collects these in the `Envelope.OtherParts` list; until now only Envelope.Attachments and Envelope.Inline were considered while parsing incoming mail.
- As some email clients send attachments without filename, especially in the multipart/related case, this PR implements `constructFilename`, which guesses the filename based on the ContentType.

How the issue was disovered:
I implemented an otherwise unrelated application written in go that parses emails with enmime just like Forgejo does.
I noticed that in a few occasions that system would fail to detect all attachments.
Investigating this issue led me to realize the above described issue.
After implementing a fix for that application, I looked through the Forgejo email parsing code and discovered the same problem.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7136
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: christopher-besch <mail@chris-besch.com>
Co-committed-by: christopher-besch <mail@chris-besch.com>
2025-03-07 17:54:26 +00:00
..
payload Replace `interface{}` with `any` (#25686) 2023-07-04 18:36:08 +00:00
incoming.go feat: parse inline attachments for incoming mail (#7136) 2025-03-07 17:54:26 +00:00
incoming_handler.go style: reenable switch check 2024-08-18 15:19:01 +02:00
incoming_test.go feat: parse inline attachments for incoming mail (#7136) 2025-03-07 17:54:26 +00:00