Ticket #1484506 (closed Bugs: fixed)

Opened 14 months ago

Last modified 4 months ago

Attachment gone when restoring saved draft e-mail without body

Reported by: R@… Owned by:
Priority: 5 Milestone: 0.1.1
Component: PHP backend Version: 0.1-rc1
Severity: critical Keywords: Attachment disappears
Cc:

Description

Hi,

first of all let me say that I appreciate your work! There seems to be a misshandling in the code, when restoring a draft e-mail whith an attachment but no text in the mail body: the attachment is gone (not listet on the left any more). I use "Create a new message", enter a recipient and add one attachment. I do not enter text in the mail body. Then I save the message with "Save this draft".

Going back to "E-Mail" on the top navi and selecting the Draft-Folder on the left displays the saved e-mail in the list with a paper-clip indicating, that there is an atttachment with the e-mail. But when I dobbleclick the e-mail it opens and the list of attachments on the left is empty.

I tried this with several different attachments of a small size -> same result.

When I look in the temp-directory on the web-server the attachment gets saved as - in this case rcmAttmnt1319tp. The attachment is in the temp-directory until I dobbleclick the formerly saved e-mail to open it again. Then the attachment disappears from the temp-folder.

Please note that this is working correctly when text is entered in th body of the e-mail: then the attachment gets displayed on the left after restoring the draft e-mail.

I looked through the open roundcube bugs but couldn't find a similar bug.

My system is a standard debian etch with PHP 5.2.0, Apache 2.2.3.

Thank you,

Regards Ralph

Attachments

snapshot1.png (105.5 kB) - added by wfong 14 months ago.
bug-1484506-fix.patch (1.0 kB) - added by tvk 11 months ago.
patch to fix this, against r921

Change History

Changed 14 months ago by wfong

Verified.

Trunk revision 774.

Please refer to my screen shot attachment.

TEST1 -> this message properly contains "TEST FILE" which is an 11 byte text file with "TEST1" in the body. TEST2 -> this message was saved with same text file as above but with no text in the body. TEST3 -> this message was saved without a text file but with "TEST3" in the body.

Sorry, I don't know the code base well enough to provide more detailed information.

Thanks, -william

Changed 14 months ago by wfong

Changed 11 months ago by tvk

The problem seems to lie in the function rcmail_create_draft_body (Line 566) of program/steps/mail/compose.inc. This function checks whether the draft being opened is a multi-part MIME message, i.e. consists of more than just the ordinary text body, and then checks whether it has more than one MIME part. If this is the case, it calls function rcmail_write_compose_attachments which will then add the existing attachments to the Compose Message view. The problem is, however, that when RoundCube saves the draft with the empty text body and the attachment, it creates a multi-part MIME message with exactly one MIME part - the attachment. Thus, Roundcube later incorrectly identifies such a message as one without attachments and consequently never adds the stored attachment. There are two possible fixes for this problem: first of all, when saving the draft, it could be saved with an empty text body MIME part and the attachment part, so the aforementioned check for more than one MIME part would work. Another fix would be to change the check itself: it would have to check instead whether the message has at least one non-text MIME part and call the rcmail_write_compose_attachments function if this is the case. I would prefer the first fix, because other parts of the programme (and maybe some spam filtering software) might also expect that every multipart MIME message has at least a text body part, plus any number of attachments.

Changed 11 months ago by tvk

patch to fix this, against r921

Changed 8 months ago by seansan

  • milestone set to 0.1.1

Review in 0.1.1

Changed 7 months ago by till

  • status changed from new to closed
  • resolution set to fixed

Thanks for the patch, committed in r1210.

Note: See TracTickets for help on using tickets.