Bug 56592

Summary: Multiline attachment's Content-Descriptions mess up middle pane (tree)
Product: [Applications] kmail Reporter: Alain Knaff <kde>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Severity: normal    
Priority: NOR    
Version: 1.5   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Alain Knaff 2003-03-29 20:45:37 UTC
Version:           1.5 (using KDE 3.1.0)
Installed from:    SuSE
Compiler:          gcc version 3.2
OS:          Linux (i686) release 2.4.21-pre5

If you receive a mail which has an attachment whose Content-Description tag is multi-line (i.e. has a continuation line, like in the example below), then the display in the "message structure" pane behaves funny (I mean the middle pane on the right hand side, which shows the "structure" of the message in a tree-like format).

For example, if the header of the attachment is as follows (note the continuation line "(for spam/abuse tracking)"):

Content-Type: text/plain; name="mailheaders.txt"
Content-Disposition: attachment; filename="mailheaders.txt"
Content-Transfer-Encoding: 7bit
Content-Description: Headers of original mail which triggered this message
    (for spam/abuse tracking)

then kmail tries to display the content description as two lines, but unfortunately, it allocates only enough screen real estate for one line: you get the lower half of the first line, and the upper half of the second.
Interestingly enough, it does not happen if you make your window small enough that it cuts before message (i.e. if message would exceed the right hand border, the funny behavior does not happen). This leads me to think that for real-estate calculation, kmail assumes that the newline character is a space (... and that the continuation line would be displayed to the right hand side of the first line), but that for the actual displaying, kmail takes the newline character as what it is, and attempts to display the second line underneath the first. IMHO, it would be preferable if kmail considered the newline character as a space for both actions.
Comment 1 Alain Knaff 2003-03-30 10:01:16 UTC
I just upgraded to KDE 3.1.1. The behavior has changed, but however the bug is not 
completely gone. 
Now the beginning of the "Description" line is displayed ok ("Headers of original mail 
which triggered this messag"). However, as soon as I make the window wide enough 
to display the final "e" of message, this is displayed half a line up. If I make it even 
wider, nothing follows (i.e. the continuation line "(for spam/abuse tracking)" is never 
seen). But, it seems to depend on how fast I resize the description column: if I resize it 
fast enough, more letters are shown half a line up. Moreover, after a window refresh 
(triggered by covering the message structure by another window, and then removing 
it), behavior is as before: first line on top of second. 
Btw, just noticed: the example above was mangled by bugzilla: the continuation line is 
supposed to start with 4 spaces (else it wouldn't be a legal continuation line). Would it 
be possible to add a "preview" mode to bugzilla, to help spot such formatting issues 
Comment 2 Ingo Kl 2003-04-01 00:55:13 UTC
Subject: kdepim/kmail

CVS commit by kloecker: 

Fix bug 56592: Displaying folded Content-Description in MIME tree viewer is broken

CCMAIL: 56592-fixed@bugs.kde.org

  M +3 -0      partNode.cpp   1.33

--- kdepim/kmail/partNode.cpp  #1.32:1.33
@@ -13,4 +13,5 @@
 #include "kmmimeparttree.h"
 #include <mimelib/utility.h>
+#include <qregexp.h>
@@ -330,4 +331,6 @@ void partNode::fillMimePartTree( KMMimeP
         cntSize = size;
+    // remove linebreak+whitespace from folded Content-Description
+    cntDesc.replace( QRegExp("\\n\\s*"), " " );
 kdDebug(5006) << "      Inserting one item into MimePartTree" << endl;