Project

General

Profile

Actions

Patch #27885

closed

Empty email attachments are imported to Redmine, creating broken DB records

Added by Felix Schäfer almost 7 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Email receiving
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

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.


Files

27885.patch (3.42 KB) 27885.patch Felix Schäfer, 2018-01-03 14:28
Actions #1

Updated by Felix Schäfer almost 7 years ago

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.

Actions #2

Updated by Go MAEDA almost 7 years ago

  • Target version set to 3.3.6

LGTM.
The fix also can be applied to 3.4-stable and 3.3-stable. Setting target version to 3.3.6.

Actions #3

Updated by Jean-Philippe Lang almost 7 years ago

  • Status changed from New to Closed

Committed, thanks.

Actions #4

Updated by Felix Schäfer almost 7 years ago

Thank you!

Actions

Also available in: Atom PDF