Vote #79044
完了Empty email attachments are imported to Redmine, creating broken DB records
0%
説明
Redmine generally disallows empty or 0-byte-sized attachments, this is not checked when importing attachments from emails through the @MailHandler@ though.
In the case of an empty email attachment, an @Attachment@ record is created, though without @disk_filename@, @disk_directory@ and @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.
journals
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.
--------------------------------------------------------------------------------
LGTM.
The fix also can be applied to 3.4-stable and 3.3-stable. Setting target version to 3.3.6.
--------------------------------------------------------------------------------
Committed, thanks.
--------------------------------------------------------------------------------
Thank you!
--------------------------------------------------------------------------------