Empty email attachments are imported to Redmine, creating broken DB records
Redmine generally disallows empty or 0-byte-sized attachments, this is not checked when importing attachments from emails through the
In the case of an empty email attachment, an
Attachment record is created, though without
digest. The attachment is then shown in the attachment list of the issue, but clicking on the attachment link to see the attachment or to download it leads to an error, as there is no file on disk for that attachment.
Empty email attachments are imported to Redmine, creating broken DB records (#27885).
Patch by Felix Schäfer.
#1 Updated by Felix Schäfer 11 months ago
- File 27885.patch added
The attached patch fixes this issues and adds a test for that case. The fixture email is copied from the
ticket_with_attachment.eml fixture and adapted accordingly. It is probably also possible to merge this test into the general attachments for emails test in that same test file.
It might also be possible and a good idea to switch to
ActsAsAttachable#save_attachments to save email attachments in the
MailHandler, as in that case attachment handling in the
MailHandler would not need to be manually synced with the logic of other places.