Bug 70169 - Certain Attachment are not fetched from IMAP
Summary: Certain Attachment are not fetched from IMAP
Status: RESOLVED WORKSFORME
Alias: None
Product: kmail
Classification: Applications
Component: IMAP (show other bugs)
Version: 1.5.94
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-11 22:06 UTC by Thomas Zander
Modified: 2007-09-14 12:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
testcase for not correctly displayed mail (1.55 KB, message/mail)
2006-09-08 12:31 UTC, Andreas Amann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Zander 2003-12-11 22:06:17 UTC
Version:           1.5.94 (using KDE 3.1.94 (CVS >= 20031206), compiled sources)
Compiler:          gcc version 3.3.2 20031005 (Debian prerelease)
OS:          Linux (i686) release 2.4.21

On an IMAP server I have the checkbox 'Load attachments on demand' checked.
When I get a certain format of emails the text file that is part of the email will never be fetched.

The format of the email is:
Email
+ - body plain/text
+ - body part Email message
  + - encapsulated message  multipart/mixed
     + - internal part	plain/text
     + - ATT1234.txt	plain/text

Its the bottom part, the text file that I would like to see. It shows fine if I set the above mentioned checkbox off, but not when I do not.
Even clicking on the message and pressing 'open in kwrite' will only open an empty kwrite. (saving to file will give me an empty file).
Comment 1 Carsten Burghardt 2003-12-12 09:12:24 UTC
Subject: Re:  New: Certain Attachment are not fetched from IMAP

On Thursday 11 December 2003 22:06, zander@kde.org wrote:
> On an IMAP server I have the checkbox 'Load attachments on demand' checked.
> When I get a certain format of emails the text file that is part of the
> email will never be fetched.
>
> The format of the email is:
> Email
> + - body plain/text
> + - body part Email message
> 
Comment 2 Thomas Zander 2003-12-12 11:07:51 UTC
The feature to "Load attachments on demand" is completely broken currently; so I can't.
I'll open a different bugreport for that and as soon as that is fixed I can give you the output for this bug.

Sorry.
Comment 3 Thomas Zander 2003-12-12 11:50:09 UTC
Oh; the "totally non functional" was a problem somewhere in kdelibs. (70208 for the interrested).

Anyway; here is a 3 part output from 1) selecting the email 2) clicking on the attatchment in the content part of the email  3) pressing 'open in kwrite' which gives me an empty window.
Notice that 2 and 3 are just a couple of lines; so completely at the bottom.

1) select email.
kmail: set Msg, force = false
kmail: enable progress
khtml (part): DONE: 17
kmail: ImapJob::slotGetMessageResult - retrieved part HEADER
kmail: (200388, last 0) Re: config/test-suite tasks, anyone? Re: [Gnu-arch-users] Re: Fat al bug in tla? Andrew Suffield, complete false
kmail: set Msg, force = true
kmail: ImapAccountBase::constructParts - created id 0 of type MULTIPART/46
kmail: ImapAccountBase::constructParts - created id 1 of type TEXT/PLAIN
kmail: ImapAccountBase::constructParts - created id 2 of type MESSAGE/RFC822
kmail: ImapAccountBase::constructParts - created id 3 of type MULTIPART/MIXED
kmail: ImapAccountBase::constructParts - created id 3.1 of type TEXT/PLAIN
kmail: ImapAccountBase::constructParts - created id 3.2 of type TEXT/PLAIN
kmail: ImapAccountBase::handleBodyStructure - load 1 (TEXT/PLAIN)
kmail: load Part
kmail: ImapAccountBase::handleBodyStructure - load 2 (MESSAGE/RFC822)
kmail: load HEADER
kmail: ImapAccountBase::handleBodyStructure - load .HEADER ()
kmail: load Part
kmail: ImapAccountBase::handleBodyStructure - load 3.1 (TEXT/PLAIN)
kmail: load Part
kmail: ImapAccountBase::handleBodyStructure - load 3.2 (TEXT/PLAIN)
kmail: load Part
kmail: ImapJob::slotGetMessageResult - retrieved part 1
kmail: KMMessage::updateBodyPart 1
kmail: ISubject::notify 1
kmail: KMReaderWin::update - message
kmail:
#######
#######
#######  parseMsg(KMMessage* aMsg == aMsg )
#######
#######
kmail:
     ----->  First body part *was* found, filling the Mime Part Tree
kmail:
        partNode::partNode()      explicitType == DwMime::kTypeUnknown
kmail:
kmail:
        partNode::partNode()      explicitType == DwMime::kTypeUnknown
kmail:
kmail:
        partNode::partNode()      explicitType == DwMime::kTypeUnknown
kmail:
kmail:
        partNode::partNode()      explicitType == DwMime::kTypeUnknown
kmail:
kmail:
        partNode::partNode()      explicitType == DwMime::kTypeUnknown
kmail:
kmail:       Inserting one item into MimePartTree
kmail:                 Content-Type: multipart/mixed
kmail:       Inserting one item into MimePartTree
kmail:                 Content-Type: MULTIPART/MIXED
kmail:       Inserting one item into MimePartTree
kmail:                 Content-Type: TEXT/PLAIN
kmail:       Inserting one item into MimePartTree
kmail:                 Content-Type: TEXT/PLAIN
kmail:       Inserting one item into MimePartTree
kmail:                 Content-Type: MESSAGE/RFC822
kmail:       Inserting one item into MimePartTree
kmail:                 Content-Type: TEXT/PLAIN
kmail: partNode::findType() is looking at Multipart/Mixed
kmail: partNode::findType() is looking at Text/Plain
kmail: partNode::findType() is looking at Message/Rfc822
kmail: partNode::findType() is looking at Multipart/Mixed
kmail: partNode::findType() is looking at Text/Plain
kmail: partNode::findType() is looking at Text/Plain
kmail: KMMessage::emailAddrAsAnchor('Andrew Suffield <asuffield@debian.org>') returns:
--><a href="mailto:Andrew%20Suffield%20%3Casuffield%40debian.org%3E">Andrew Suffield &lt;asuffield@debian.org&gt;</a><--
kmail: KMMessage::emailAddrAsAnchor('gnu-arch-users@gnu.org') returns:
--><a href="mailto:gnu-arch-users%40gnu.org">gnu-arch-users@gnu.org</a><--
kmail:
**
** ObjectTreeParser::parseObjectTree( node OK, showOnlyOneMimePart: FALSE ) **
**
kmail: partNode::findType() is looking at Text/Plain
kmail: partNode::findType() is looking at Text/Plain
kmail: partNode::findType() is looking at Message/Rfc822
kmail: partNode::findType() is looking at Multipart/Mixed
kmail: partNode::findType() is looking at Text/Plain
kmail: partNode::findType() is looking at Message/Rfc822
kmail: partNode::findType() is looking at Multipart/Mixed
kmail:
**
** ObjectTreeParser::parseObjectTree( node OK, showOnlyOneMimePart: FALSE ) **
**
kmail: WARNING: Unknown codec "8bit" requested!
kmail: WARNING: KMMessagePart::bodyDecoded(): body is binary but used as text!
kmail:
----->  Initially processing data of embedded RfC 822 message
kmail:
kmail:
----->  Store RfC 822 message header "From: "
kmail:
kmail:
        partNode::partNode()      explicitType == DwMime::kTypeUnknown
kmail:
kmail:
        partNode::partNode()      explicitType == DwMime::kTypeUnknown
kmail:
kmail:
        partNode::partNode()      explicitType == DwMime::kTypeUnknown
kmail:
kmail:
     ----->  Inserting items into MimePartTree
kmail:
kmail:       Inserting one item into MimePartTree
kmail:                 Content-Type: text/plain
kmail:
     <-----  Finished inserting items into MimePartTree
kmail:
kmail:
     ----->  Now parsing the MimePartTree
kmail:
kmail:
**
** ObjectTreeParser::parseObjectTree( node OK, showOnlyOneMimePart: FALSE ) **
**
kmail:
     <-----  Finished parsing the MimePartTree in insertAndParseNewChildNode()
kmail:
kmail: partNode::findType() is looking at Text/Plain
kmail: partNode::findType() is looking at Text/Plain
kmail: partNode::findType() is looking at Text/Plain
kmail: partNode::findType() is looking at Text/Plain
kmail: partNode::findType() is looking at Text/Plain
kmail:
**
** ObjectTreeParser::parseObjectTree( node OK, showOnlyOneMimePart: FALSE ) **
**
kmail: KMReaderWin  -  finished parsing and displaying of message.
khtml (part): DONE: 105
kmail: ImapJob::slotGetMessageResult - retrieved part 2.MIME
kmail: KMMessage::updateBodyPart 2
kmail: WARNING: ImapJob::slotGetMessageResult - got no data for .HEADER
kmail: WARNING: ImapJob::slotGetMessageResult - got no data for 3.1
kmail: WARNING: ImapJob::slotGetMessageResult - got no data for 3.2


2) click attatchment.

kmail: [virtual void KHTMLPart::urlSelected(const QString&, int, int, const QString&, KParts::URLArgs)] file:/tmp/kde-zander/kmailS0lr6a.7/ATT00010.txt
khtml: urlSelected: complete URL:file:/tmp/kde-zander/kmailS0lr6a.7/ATT00010.txt target =
kio (KTrader): KServiceTypeProfile::offers( text/plain,Application )
kio (KTrader): Returning 3 offers


3) select 'open with kwrite' 

kmail: enable progress
kmail: WARNING: ImapJob::slotGetMessageResult - got no data for 3.2
kfile (kdelibs): KRecentDocument::add for file:/tmp/kde-zander/kmailS0lr6a.7/ATT00010.txt
kio (KRun): KRun::run /usr/local/kde/share/applications/kde/kwrite.desktop
kio (KRun): First url file:/tmp/kde-zander/kmailS0lr6a.7/ATT00010.txt
kio (KRun): startServiceByDesktopPath worked fine
kmail: processNextCheck, remaining 1

Comment 4 Carsten Burghardt 2003-12-12 19:15:22 UTC
Subject: Re:  Certain Attachment are not fetched from IMAP

On Friday 12 December 2003 11:50, zander@kde.org wrote:
> kmail: WARNING: ImapJob::slotGetMessageResult - got no data for 3.1
> kmail: WARNING: ImapJob::slotGetMessageResult - got no data for 3.2

Well, either the BODYSTRUCTURE response from the imap server is buggy or the 
parsing from the kioslave. What imap server is this? 
Please save the  msg (perhaps copy if to a local account first to work around 
the bug ;-) ) and attach it to the report gzip'ped (or send it directly to me 
if you don't want that).


Carsten

Comment 5 Thomas Zander 2003-12-12 22:10:46 UTC
Server is courier-imap  version 1.4.3-2.3 (thats debian numbering; so everything before the dash is official release numbering).

About saving the message; there are a couple of people on a certain mailinglist that consistently create such messages so its quite easy to reproduce.  Unfortunately the gnu.org archives are offline so I can't sent you a URL to it.
I'll forward one email privately to you.
Comment 6 Carsten Burghardt 2003-12-13 18:54:28 UTC
Subject: kdebase/kioslave/imap4

CVS commit by burghard: 

Correctly detect encap messages

CCMAIL: 70169-done@bugs.kde.org


  M +1 -1      imapparser.cc   1.55


--- kdebase/kioslave/imap4/imapparser.cc  #1.54:1.55
@@ -859,5 +859,5 @@ mimeHeader * imapParser::parseSimplePart
 
   // type specific extensions
-  if (localPart->getType() == "MESSAGE/RFC822")
+  if (localPart->getType().upper() == "MESSAGE/RFC822")
   {
     //envelope structure


Comment 7 Thomas Zander 2003-12-14 13:01:59 UTC
This commit only made things worse; the correct message structure (as confirmed by mutt) is no longer recogniced and now I don't even see the attachment to click on anymore.
Comment 8 Ingo Klöcker 2003-12-14 15:30:42 UTC
Carsten, JFYI everything in the IMAP protocol is case insensitive (there's another bug report for this). It's only per chance that we so far didn't have any problems because luckily almost all servers seem to use only upper case.

So in short words: We have to use upper() everywhere where we compare something with an upper case IMAP entity.
Comment 9 Carsten Burghardt 2003-12-24 15:54:25 UTC
Do you still see the problem? I can't reproduce it anymore.
Comment 10 Thomas Zander 2003-12-24 19:24:35 UTC
Yes, I still have this; there is no change. I recently (today) compiled the whole of KDE on a new machine and its still there.

Could you try to reproduce with "View -> Attachments -> As Icon" ?

Don't forget to restart KMail after you change this since mails are pretty aggressively cached :)
Comment 11 Thomas Zander 2004-01-05 23:16:58 UTC
As this functionality does not work currently; making KMail not show content while there is some, even saving/copying messages incorrectly (data loss!) I recommend to remove the checkbox from the config dialog and release KMail without. (there is life after 3.2)

It would be a shame if a non-finished feature would give customers the idea KMail was buggy and unpredictable.
Comment 12 Carsten Burghardt 2004-01-06 00:19:49 UTC
Subject: Re:  Certain Attachment are not fetched from IMAP

On Monday 05 January 2004 23:16, zander@kde.org wrote:
> As this functionality does not work currently; making KMail not show
> content while there is some, even saving/copying messages incorrectly (data
> loss!) I recommend to remove the checkbox from the config dialog and
> release KMail without. (there is life after 3.2)
>
> It would be a shame if a non-finished feature would give customers the idea
> KMail was buggy and unpredictable.

Well, your testcase is handled correctly now, I fixed this last week. Do you 
agree?
Copying messages also works again. So what remains as a bug?


Carsten

Comment 13 Thomas Zander 2004-01-07 10:09:17 UTC
> Well, your testcase is handled correctly now, I fixed this last week. Do you 
agree?
No, I did a clean recompile to be sure the bug was not on my side; and the original bug still is there.
Comment 14 Carsten Burghardt 2004-01-07 12:57:52 UTC
I tested the email that you sent me with iconic attachment style and it worked without a problem. Can you send me another one that creates this problem?
Comment 15 Carsten Burghardt 2004-01-24 16:10:20 UTC
Works here and Till confirmed this.
Comment 16 Thomas Zander 2004-01-25 16:10:56 UTC
Just for clarity; on my side the problem is still visible.
Comment 17 Andreas Amann 2006-09-07 20:08:33 UTC
Unfortunately this bug is not fixed yet! I could reproduce it with a freshly compiled kde-svn build as of today. 

An encapsulated message with an attachment is not displayed correctly over imap, when the "Load attachments on demand" box is checked. My "solution" is to uncheck that box. 

Can you please reopen this bug?
Comment 18 Carsten Burghardt 2006-09-08 10:40:08 UTC
Can you provide such a message? If yes please save it, zip it and attach
it to this report or send it to me.
Comment 19 Andreas Amann 2006-09-08 12:31:39 UTC
Created attachment 17666 [details]
testcase for not correctly displayed mail

The attached message is a minimal test case. When I have the 
"fetch attachments on demand" box checked and fetch it from an imap server, it
is not correctly displayed. The Subject, from, to, and date fields are missing
in the encapsulated message part. When I click on the "encapsulated message"
header, I get a window showing an empty message.
Comment 20 Andreas Amann 2006-09-08 12:36:39 UTC
Just one other observation. The message gets displayed correctly after I press "v" to view the source. Then not only the source window pops up, but also the embedded preview part gets updated. 
Comment 21 Arne Henningsen 2006-12-20 09:11:39 UTC
Is this bug a duplicate of Bug 95093 (http://bugs.kde.org/show_bug.cgi?id=95093)?
Comment 22 Andreas Amann 2006-12-20 12:08:59 UTC
Both bugs relate to a 'Load attachments on demand' issue and may well have the same origin, however I think both bugs are at least different in their symptoms. Bug 70169 is about mail attachments which are encapsulated messages. They are not loaded and displayed as expected when clicked. Bug 95093 as I understand it is about saving attachments which result in empty files. 

Can you reproduce Bug 70169 with my test message http://bugs.kde.org/attachment.cgi?id=17666&action=view ?
Comment 23 Arne Henningsen 2006-12-20 12:29:24 UTC
How can I try to reproduce the bug? I have downloaded the file "attachment.cgi" but I did not manage to open it in kmail.
Comment 24 Andreas Amann 2006-12-20 16:16:47 UTC
the file is gzipped, use ungzip to inflate. Then open the resulting file with ctrl-o in kmail (possibly you will not see the file open-dialog due to a filter, but just type the filename in the location box and it will open). When the message pops up  use Message -> Forward -> Redirect to send to your imap mailbox. 

Now look at your imap mailbox and click on the  "Encapsulate Message" label.
The window that pops up just shows an empty message. To see that this is imap related just click on the "Encapsulated Message" label after you opened the message with ctrl-o. In this case the embedded message pops up correctly. 
Comment 25 Arne Henningsen 2006-12-20 19:33:04 UTC
Thank you for your instructions. I did not receive the redirected message, but I can reproduce this bug with a forwarded message. And I can also reproduce that unchecking the box "Load attachments on demand" solves this problem.