discourse/lib/email
Régis Hanol 5fcb7c262d
FIX: prevents duplicate attachments in incoming emails (#25986)
## What?

Depending on the email software used, when you reply to an email that has some attachments, they will be sent along, since they're part of the embedded (replied to) email.

When Discourse processes the reply as an incoming email, it will automatically add all the (valid) attachments at the end of the post. Including those that were sent as part of the "embedded reply".

This generates posts in Discourse with duplicate attachments 🙁

## How?

When processing attachments of an incoming email, before we add it to the bottom of the post, we check it against all the previous uploads in the same topic. If there already is an `Upload` record, it means that it's a duplicate and it is _therefore_ skipped.

All the inline attachments are left untouched since they're more likely new attachments added by the sender.
2024-03-01 18:38:49 +01:00
..
authentication_results.rb DEV: Apply syntax_tree formatting to `lib/*` 2023-01-09 12:10:19 +00:00
build_email_helper.rb DEV: Apply syntax_tree formatting to `lib/*` 2023-01-09 12:10:19 +00:00
cleaner.rb DEV: Apply syntax_tree formatting to `lib/*` 2023-01-09 12:10:19 +00:00
message_builder.rb DEV: Apply syntax_tree formatting to `lib/*` 2023-01-09 12:10:19 +00:00
message_id_service.rb DEV: Prefer \A and \z over ^ and $ in regexes (#19936) 2023-01-20 12:52:49 -06:00
poller.rb FEATURE: Add hooks for email poller plugins (#21384) 2023-06-26 13:16:03 +08:00
processor.rb FIX: Prevent Email Processor errors when mail is blank or nil (#21292) 2023-05-18 10:39:37 +08:00
receiver.rb FIX: prevents duplicate attachments in incoming emails (#25986) 2024-03-01 18:38:49 +01:00
renderer.rb DEV: Add apply_modifier in Email::Renderer for html modifications (#25205) 2024-01-12 09:14:55 -06:00
sender.rb FIX: Properly attach secure images to email for non-secure uploads (#23865) 2023-10-17 14:08:21 +10:00
styles.rb DEV: Fix various rubocop lints (#24749) 2023-12-06 23:25:00 +01:00
validator.rb DEV: Apply syntax_tree formatting to `lib/*` 2023-01-09 12:10:19 +00:00