Bug 333150

Summary: Deleting attachment removes the entire message
Product: [Applications] kmail2 Reporter: michael.zugaro
Component: commands and actionsAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: critical CC: bugs.kde.org, fabstz-it, ws
Priority: NOR    
Version: 4.14.2   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 4.14.6

Description michael.zugaro 2014-04-07 09:31:14 UTC
Deleting attachment removes the entire message as well. Examining the corresponding file (in .local/share/…) using a text editor confirms that the original text is gone.

Reproducible: Always

Steps to Reproduce:
1. Select a message containing some text and an attachment
2. Right-click on the attachment and select Delete (or whatever it is called in English)

Actual Results:  
The attachment and entire message text are removed, and replaced with a new text explaining that the attachment was deleted.

Expected Results:  
Only the attachment should be removed, while the rest of the message should remain unchanged.
Comment 1 ws 2014-09-06 11:49:57 UTC
same bug at my system
openSUSE 12.3
Plattform-Version 4.10.5 "release 1"
protocol IMAP
and POP

there is no problem at Thunderbird
Comment 2 Erik Quaeghebeur 2014-11-28 09:14:06 UTC
I can confirm this bug for 4.12.5 on Gentoo. It does not occur for all deletions, but I have not found which MIME structure is vulnerable and which is not. Upon request, i can furnish the developer with a message that triggers this bug (I had copied one from the same sender that had sent a message earlier which triggered this bug); I am not willing to post this message here, as it contains too much personally identifiable info.

This is a really bad bug!
Comment 3 Erik Quaeghebeur 2014-11-28 09:39:50 UTC
Ok, I discovered the following:

The problem occurs in the following MIME structure:

  multipart/mixed [multipart/alternative [text/plain, text/html], application/pdf(attachment disposition)]

deleting the attachment creates the following *invalid* MIME structure

  multipart/alternative [text/x-moz-deleted(attachment disposition)]

instead of

  multipart/mixed [multipart/alternative [text/plain, text/html], text/x-moz-deleted(attachment disposition)]

On the other hand

  multipart/mixed [text/plain, application/pdf(attachment disposition)]

and

  multipart/mixed [multipart/alternative [text/plain, text/html], application/pdf(attachment disposition), application/pdf(attachment disposition)]

correctly give

  multipart/mixed [text/plain, text/x-moz-deleted(attachment disposition)]

and

  multipart/mixed [multipart/alternative [text/plain, text/html], application/pdf(attachment disposition), text/x-moz-deleted(attachment disposition)]
  multipart/mixed [multipart/alternative [text/plain, text/html], text/x-moz-deleted(attachment disposition), text/x-moz-deleted(attachment disposition)]
Comment 4 Erik Quaeghebeur 2014-12-13 17:08:42 UTC
I tested, and this is still present in 4.14.3. Perhaps the original reporter or a developer can update the version in the bug description?
Comment 5 Fab Stz 2015-02-12 19:46:46 UTC
Present in Debian Jessie too (with kdepim 4.14.1 & kdepimlibs 4.14.2)
Comment 6 Fab Stz 2015-02-12 19:49:16 UTC
Looks like a duplicate of bug 312276 ?
Comment 7 Erik Quaeghebeur 2015-02-13 09:12:55 UTC
(In reply to Fab Stz from comment #6)
> Looks like a duplicate of bug 312276 ?

Indeed; I'll ask them to indicate it as such.
Comment 8 Laurent Montel 2015-02-14 13:18:12 UTC
Git commit e9b653b1389bd7afc38b0e7effa5c511264a002f by Montel Laurent.
Committed on 14/02/2015 at 13:17.
Pushed by mlaurent into branch 'KDE/4.14'.

Fix Bug 312276 - removing (deleting) an attachment loses the email contents as well for some mails

FIXED-IN: 4.14.6
Related: bug 312276

It needs kdepim too

M  +52   -28   kmime/kmime_content.cpp
M  +2    -0    kmime/kmime_content.h

http://commits.kde.org/kdepimlibs/e9b653b1389bd7afc38b0e7effa5c511264a002f