Bug 143237 - Non multipart MIME mails containing only a single attachment fail
Summary: Non multipart MIME mails containing only a single attachment fail
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: mime (show other bugs)
Version: 1.9.5
Platform: OpenSUSE Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
: 113516 127214 142068 143490 144609 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-03-19 21:30 UTC by Hans-Peter Jansen
Modified: 2009-09-06 19:09 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
send non multipart MIME mail containing a single attachment (2.92 KB, application/x-python)
2007-03-19 21:32 UTC, Hans-Peter Jansen
Details
small test pdf to play with.. (8.78 KB, application/pdf)
2007-03-19 21:33 UTC, Hans-Peter Jansen
Details
My bad email (94.42 KB, text/plain)
2007-03-20 21:45 UTC, Neale Pickett
Details
gzipped email that demonstrates the bug (227.32 KB, application/x-gzip)
2008-01-25 14:12 UTC, Lars DIECKOW
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hans-Peter Jansen 2007-03-19 21:30:12 UTC
Version:           1.9.5 (using KDE KDE 3.5.5)
Installed from:    SuSE RPMs
OS:                Linux

It's quite popular to receive non multipart MIME mails containing a single attachment today, e.g. PDF invoices/delivery notices, and mails from all those Win* office users using "Mail this file".

Clicking on the attachment should open the related application in order to consume its content. Unfortunately, for kmail users it's not that easy, since the app either throws an error (ooo), or shows an more or less empty document (kpdf). But wait, viewing the "source code" of that message (key "V" in my german kmail) before clicking on the attachment "fixes" that problem (as long as this message is still shown).

This problem seems to exist for a long time, and persists in KDE 3.5.6 from SUSE BS, but today I finally got around to create a script, that generates such offending messages.

Use the "problem construction set" this way:
sendattachment.py -f from@x -t your@address -s \ mailserver.site -c 'application/pdf' testa.pdf

Check your INBOX, and try to view or save it. Check the result: the file should be damaged. Now view the message source and try again. It should work now, but is quite a hassle to explain this to users..

If you cannot reproduce it, let me know (I'm using Cyrus IMAP here).
Comment 1 Hans-Peter Jansen 2007-03-19 21:32:19 UTC
Created attachment 20040 [details]
send non multipart MIME mail containing a single attachment
Comment 2 Hans-Peter Jansen 2007-03-19 21:33:17 UTC
Created attachment 20041 [details]
small test pdf to play with..
Comment 3 Thomas McGuire 2007-03-20 14:51:59 UTC
Is this the same as bug 113516 maybe?
Comment 4 Thomas McGuire 2007-03-20 15:06:14 UTC
Actually, it could also be the same as bug 142068.
What happens if you save the attachment? Does it get truncated?
Does the message have the attachment flag in the message list?
Comment 5 Hans-Peter Jansen 2007-03-20 15:28:58 UTC
Hi Thomas, thanks for caring.

> Is this the same as bug 113516 maybe? 
> Actually, it could also be the same as bug 142068.

Yes, basically they're all the same problem! Sorry for not querying the 
problem exhaustively enough... 

> What happens if you save the attachment? Does it get truncated? 
Well, it's not truncated, it's way shorter than the original, but it's distorted, üzgül so to say:

-rw------- 1 hp site  365 20. Mär 15:23 tmp/MIMEmailwithsingle attachment.pdf
-rw-rw-r-- 1 hp site 8989 19. Mär 21:32 tmp/testa.pdf

> Does the message have the attachment flag in the message list? 
No.
 
This report has some advantages over the others, since it's formulated more general, tells a workaround, which will do for the others guys in the meantime, with the plus to being able to reproduce it with minimum effort. I'm sure, it gives a kmail developer enough hints to finally fix this ugly issue.. Thus I vote for "duplicating" the others.

From my POV, it's the most annoying issue with kmail in enterprise environments ATM.
Comment 6 Thomas McGuire 2007-03-20 15:46:32 UTC
>Hi Thomas, thanks for caring.
Don't get your hopes up, I'm just trying to make sure incoming bugs are no duplicates. I am not a KMail developer myself.

>This report has some advantages over the others, since it's formulated more general, tells a workaround, which will do for the others guys in the meantime, with the plus to being able to reproduce it with minimum effort. I'm sure, it gives a kmail developer enough hints to finally fix this ugly issue.. Thus I vote for "duplicating" the others. 
OK, I'll close them as duplicates.
 
Comment 7 Thomas McGuire 2007-03-20 15:47:17 UTC
*** Bug 142068 has been marked as a duplicate of this bug. ***
Comment 8 Thomas McGuire 2007-03-20 15:47:32 UTC
*** Bug 113516 has been marked as a duplicate of this bug. ***
Comment 9 Thomas McGuire 2007-03-20 15:58:26 UTC
There is a test mail available at http://woozle.org/~neale/tmp/T-Board Agenda for March 1 Meeting (from one of the dupliate reports).
However, I can not reproduce the problem with that mail (I saved it as text file and put it in my inbox folder). Saving and opening it with OOO from within KMail worked fine.
Comment 10 Neale Pickett 2007-03-20 21:45:26 UTC
Created attachment 20058 [details]
My bad email

This is probably less useful than the python script, but here's the email that
caused problems for me.  It will be removed from my web server soon.
Comment 11 Hans-Peter Jansen 2007-03-21 00:50:18 UTC
>> Hi Thomas, thanks for caring. 
> Don't get your hopes up, I'm just trying to make sure incoming bugs are no 
> duplicates. I am not a KMail developer myself.

Yup, I know, since I cursory follow kde-pim ML. They seem busy with kde4 stuff all the time. But nevertheless, you're doing something important for this great MUA and its developers. Hopefully, somebody will pick it up one day.

> This is probably less useful than the python script

Did someone from the kind audience tried to reproduce it with the script? Sure, I did, but I'm awaiting confirmation since I put this bug into SUSE bugzilla #120238, exactly one month ago :-( Needless to say, I haven't got a single reply there, that's why I'm here..
Comment 12 Thomas McGuire 2007-03-27 16:53:37 UTC
*** Bug 143490 has been marked as a duplicate of this bug. ***
Comment 13 Thomas McGuire 2007-04-29 19:59:44 UTC
*** Bug 144609 has been marked as a duplicate of this bug. ***
Comment 14 Thomas McGuire 2007-04-29 20:01:25 UTC
The reporter in bug 144609 says that turning off "load attachments on demand" works around this problem. 
So maybe this is only a problem for IMAP accounts.
Comment 15 Will Stephenson 2007-04-30 14:27:41 UTC
This was indeed the case.

Fixed by commit r653900
Comment 16 Thomas McGuire 2007-04-30 16:30:31 UTC
>Fixed by commit r653900 
Really? looks like a different thing to me:

>SVN commit 653900 by wstephens:

>Allow the user to cancel kmail connection attempts when the account
>settings are incorrect (Novell bug 247903).
>BUG:93199
Comment 17 Will Stephenson 2007-04-30 17:10:43 UTC
SVN commit 659645 by wstephens:

Add comment so that posterity can see that r653900 actually solved bug #143237.
CCBUG: 143237


 M  +2 -2      imapaccountbase.cpp  


--- branches/KDE/3.5/kdepim/kmail/imapaccountbase.cpp #659644:659645
@@ -1070,10 +1070,10 @@
       }
     }
     // if the only body part is not text, part->loadPart() would return false
-    // and that part is never loaded, so make sure it loads. 
+    // and that part is never loaded, so make sure it loads.
     // it seems that TEXT does load the single body part even if it is not text/*
     if ( mBodyPartList.count() == 1 && partsToLoad == 0 )
-        partsToLoad = 1;
+        partsToLoad = 1; // this causes the next test to succeed, and loads the whole message
 
     if ( (mBodyPartList.count() * 0.5) < partsToLoad )
     {
Comment 18 Will Stephenson 2007-04-30 17:11:52 UTC
My original commit message was incomplete, both #93199 and #143237 were fixed by the one commit.
Comment 19 Thomas McGuire 2007-04-30 17:17:15 UTC
> My original commit message was incomplete, both #93199 and #143237 were
> fixed by the one commit.

Ah OK, thanks!
Comment 20 Hans-Peter Jansen 2007-04-30 21:21:17 UTC
..and I confirm, that applying this patch to various kdepim versions from 3.4.0 to 3.5.6 fixes this ugly issue without any adverse effects.

Good work, Will.
Comment 21 Thomas McGuire 2007-07-19 21:35:22 UTC
*** Bug 127214 has been marked as a duplicate of this bug. ***
Comment 22 Lars DIECKOW 2008-01-25 14:11:10 UTC
Version: 1.9.7 (KDE 3.5.7, Gentoo)
Compiler: Target: i686-pc-linux-gnu
OS: Linux (i686) release 2.6.18-gentoo-r3

I confirm the bug as described in comment #1 of bug 113516, which has been marked as a duplicate of this bug. In the list pane the paperclip icon is not shown for messages that consist of a single non-text/* part.
Comment 23 Lars DIECKOW 2008-01-25 14:12:40 UTC
Created attachment 23270 [details]
gzipped email that demonstrates the bug
Comment 24 Will Stephenson 2008-01-27 10:40:48 UTC
Reopening so that the attachment indicator mentioned in comment #22 can be fixed
Comment 25 Martin Koller 2009-09-06 19:09:12 UTC
SVN commit 1020581 by mkoller:

BUG: 143237

Check for an attachment not only in the first BodyPart but in the Message itself if it has no first BodyPart.


 M  +8 -9      kmmessage.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1020581