Bug 95093 - Saving attachments with IMAP result in zero size files
Summary: Saving attachments with IMAP result in zero size files
Status: RESOLVED REMIND
Alias: None
Product: kmail
Classification: Applications
Component: IMAP (show other bugs)
Version: 1.7.1
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords: triaged
: 127929 140498 146661 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-12-13 19:35 UTC by ieure
Modified: 2022-09-23 15:04 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
IMAP message with attachment (9.03 KB, text/plain)
2005-06-14 23:07 UTC, ieure
Details
Message whose attachment saves as an empty file (5.99 KB, text/plain)
2011-10-07 22:15 UTC, Davor Cubranic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ieure 2004-12-13 19:35:56 UTC
Version:           1.7.1 (using KDE 3.3.1,  (3.1))
Compiler:          gcc version 3.3.5 (Debian 1:3.3.5-2)
OS:                Linux (i686) release 2.6.9-1-686

I have problems saving attachments from my IMAP account. When I try to save them, I get a file with the correct name, but empty (zero bytes).

It doesn't seem to matter how I try to save. I have tried:

- Viewing the body part, right-clicking the attachment and selecting 'Save as'
- Dragging & dropping the attachment icon from the KMail window to the folder I want to save it in
- Right-clicking the attachment part in the message structure viewer and selecting 'Save As'
- Selecting the attachment part in the structure viewer, right-clicking the icon in the message view pane and selecting 'Save As'
- Selecting the attachment part in the structure viewer, dragging the icon in the message view pane to the destination folder

None of these methods are reliable. I have to try several of them a few times before I get the actual file.
Comment 1 Carsten Burghardt 2004-12-17 20:48:28 UTC
What imap server is this? Can you provide an email where you can't save the 
attachment? Please gzip it before.

Comment 2 ieure 2004-12-17 21:30:51 UTC
I have seen this happen with Courier IMAP and UW-IMAP. I don't know the Courier version (it's my ISP's mail server), but UW-IMAP is 4:2001adebian-6 from Debian Woody.

It happens with most all attachments I get. It seems intermittent, but I don't know for sure that it's not the email itself. I'll send some test messages and see if I can get one to reproduce the problem.
Comment 3 ieure 2005-06-14 21:46:46 UTC
Still present in 3.4.1.

If I click on the image, or drag it to where I want to save it, I almost always end up with a zero-byte image. If I right-click and "save as," it usually works.

Once I have gotten an empty file, I can't save any attachments from the image. I have to select another message, go back to the original, and right-click -> save as to get the attachment.

I don't know if I can provide an accurate message to test with. This happens with nearly every message I get, so it should be easily reproduceable.
Comment 4 Carsten Burghardt 2005-06-14 22:42:15 UTC
> If I click on the image, or drag it to where I want to save it, I almost
> always end up with a zero-byte image. If I right-click and "save as," it
> usually works.


Drag and drop should be deactivated for imap so I wonder how you do that.

> I don't know if I can provide an accurate message to test with. This
> happens with nearly every message I get, so it should be easily
> reproduceable.


If you can provide an email together with a procedure to reproduce - that 
would be good.
Comment 5 ieure 2005-06-14 22:59:48 UTC
Hmm, you're right about DnD. I didn't notice because it never worked and I got in the habit of right-click saving.
Comment 6 ieure 2005-06-14 23:07:21 UTC
Created attachment 11454 [details]
IMAP message with attachment

Here's an example message which didn't work for me.
Comment 7 Carsten Burghardt 2005-06-15 09:48:31 UTC
Thanks for the example. And how do you exactly reproduce the problem?
Comment 8 ieure 2005-06-16 03:32:14 UTC
Shift-click the attachment, or left-click it.

Most of the time, it won't save/open correctly.

With larger attachments, you can see the progressbar in KMail as the attachment downloads. If the save/open dialog pops up immediately, you get a zero-byte file (i.e. it thinks it's been downloaded from the IMAP server when it hasn't).
Comment 9 Carsten Burghardt 2005-06-16 09:02:55 UTC
> Shift-click the attachment, or left-click it.


Shift click is known and already fixed in HEAD and the current 3.4 version
(will be 3.4.2).
I'll try normal click but this should definitely work.
Comment 10 rgpublic 2005-06-29 10:38:09 UTC
Some attachments dont save properly here, too.
They are not zero bytes but very short 130 Bytes (perhaps truncated
though I didnt verify that).
It already shows the wrong attachment size in the attachment pane.
I'm connecting to an MS Exchange server via IMAP.
Downloading the same attachment with Evolution works correctly.
I dont want to post this here in the bug system as the message doesnt really
contain public information but can mail it on demand to a kde-developer.
Interestingly, the X-Length field says 30129 bytes. As the message does
not contain any text where is all the missing information?
Comment 11 Dmitri Petrov 2005-09-02 18:34:22 UTC
Same problem here. After I compiled KDE 3.4.2 the new version of KMail stopped handling attachments properly on my IMAP accounts. When I try to save the attachment it creates the file but it stays empty.

I have to say that I am appalled by this problem. How can a mail client that can not handle attachments be released along with a stable release of KDE? Also I am wondering how it happens that these "bugfix" releases actually break things? 
Comment 12 Andreas Gungl 2005-09-02 20:44:30 UTC
> I have to say that I am appalled by this problem. How can a mail client
> that can not handle attachments be released along with a stable release of
> KDE? Also I am wondering how it happens that these "bugfix" releases
> actually break things?


Too few testers of the versions before the release? Not enough qualified i.e. 
reproducible bug reports? Limited development and bug hunting capacity?

OTOH the fixes for the mentioned showstoppers had been made public, so I 
really wonder why so many people run outdated (in the sense of not using the 
latest source code of the stable branches) versions.
Comment 13 Dmitri Petrov 2005-09-05 20:55:53 UTC
*** This bug has been confirmed by popular vote. ***
Comment 14 Carsten Burghardt 2005-09-06 07:21:29 UTC
> ------- Same problem here. After I compiled KDE 3.4.2 the new version of
> KMail stopped handling attachments properly on my IMAP accounts. When I try
> to save the attachment it creates the file but it stays empty.


You checked out 3.4 from branch and still have this problem? What about 3.5?
Please compile with debug enabled and attach the output of kmail when you 
click on an attachment.
Comment 15 Dmitri Petrov 2005-09-08 05:43:06 UTC
I have downloaded the kde 3.4.2 source from the ftp server, compiled everything etc... I have not used version from CVS. 

Here is the output of the kmail (1.8.2) that occurs when I try to save an attachment.

===================================================

kmail: ImapJob::slotGetMessageResult - retrieved part 2
kmail: KMMessage::updateBodyPart 2
kmail: ISubject::notify 1
kmail: KMReaderWin::update - can't find node for part
kmail: ImapJob::slotGetMessageResult - retrieved part 2
kmail: KMMessage::updateBodyPart 2
kmail: ISubject::notify 1
kmail: KMReaderWin::update - can't find node for part

=======================================================

I will try to get the latest version of kmail from CVS and check if the problem is still there.
Comment 16 Dmitri Petrov 2005-09-10 20:51:02 UTC
The issue is resolved in the 3.5 branch of SVN. Here is the version information:


KDE: 3.4.90 (alpha1, >= 20050806)
KMail: 1.8.91
Comment 17 Kde 2005-09-13 19:40:58 UTC
Please fix this in the 3.4 branch as well! This is extremely annoying and should not have happened in a stable release.
Comment 18 Maxime Gamboni 2005-12-21 16:21:05 UTC
I also have observed this bug. I am now running KDE 3.5.0 (Kmail 1.9) but it was present in previous versions too. It behaves non-deterministically and seems not to depend on the message. When I have a message containing many attachments some of them exhibit this behaviour but not all, and it does not seem to be consistent accross attempts.
I've observed sometimes messages are saved with zero bytes, sometimes more than zero bytes.
In the latter case it is not truncated, just seems random bytes (that do not appear in the complete file, at least not contiguously).
The following messages repeatedly output by kmail when saving/opening the attachment might be relevant:

kmail: WARNING: Base64Decoder: unexpected padding character in input stream
kmail: WARNING: Base64Decoder: Embedded padding character encountered!

Thanks,

Maxime
Comment 19 Michael Seiwert 2006-11-01 06:48:59 UTC
Does this bug occur with a newer kmail (1.9.5) KDE 3.5.5 ?
Comment 20 Arne Henningsen 2006-11-03 08:14:57 UTC
I have observed this bug rather seldom (less than once a month). In these situations I moved the mail into a local folder, because this allowed me to save the attachment. I am using KDE 3.5.5 and kmail 1.9.5 since two or three weeks now and I did not observe this bug since then. I will post another message if this bug occurs again.

Anyway, thanks for your great work,
Arne
Comment 21 Arne Henningsen 2006-12-20 09:03:16 UTC
I have observed this bug again -- two times from the same sender. The attachments are text files (R scripts with extension .R). The emails had been sent from the online platform http://www.gmx.de/. When I uncheck the box "Load attachments on demand" everything works fine.

Arne

Comment 22 Arne Henningsen 2006-12-20 09:13:18 UTC
Is this bug a duplicate of Bug 70169 (http://bugs.kde.org/show_bug.cgi?id=70169)
Comment 23 Bram Schoenmakers 2007-01-23 17:33:15 UTC
*** Bug 140498 has been marked as a duplicate of this bug. ***
Comment 24 Willi Richert 2007-01-30 09:51:23 UTC
The same for me: "Save As..." saves with zero bytes. But "Save attachments..." (don't know exact wording in english) works.
1.9.5 (KDE 3.5.5, Kubuntu (dapper) 4:3.5.5-0ubuntu1~dapper2)
Comment 25 Ferdinand Gassauer 2007-01-31 13:22:23 UTC
Can confirm this on SuSE 10.2 kmail 1.9.6 imap account (SuSE Open Exchange Server)

attachments are (mostly?) not downloaded in time to be opened with any application. (kpdf, kmail itself for embedded mails, Openoffice)

I have enabled "Load attachment on demand"

If disabled it seems to work fine. (but thats only fine on local 100Mb networks)
Comment 26 Thomas McGuire 2007-06-11 19:14:31 UTC
Adjusting summary.
Comment 27 Thomas McGuire 2007-06-11 19:15:10 UTC
*** Bug 146661 has been marked as a duplicate of this bug. ***
Comment 28 Olivier Vitrat 2007-06-21 16:37:18 UTC
Also reported in Debian BTS at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=412629
Comment 29 Alex Merry 2008-02-29 12:39:55 UTC
I'm getting this with KMail in trunk.  Saving from "local folders" is fine, saving from IMAP results in empty files.  I get this with both my university IMAP server (not sure what it is) and a local Dovecot server).

Interestingly, using the "Save all attachments" option works fine - there's only a problem if you select an individual attachment and click "save as" or "open with" or "open".
Comment 30 Thomas McGuire 2008-05-16 19:06:36 UTC
At least the bug in trunk (see comment 29) is fixed now.
Comment 31 Michael Leupold 2008-09-14 16:11:08 UTC
According to Thomas McGuire this has been fixed quite a while ago. I'm closing this now. Please reopen if this problem persists or if you encounter what you think is the same bug!
Comment 32 Björn Ruberg 2009-12-26 00:53:27 UTC
*** Bug 127929 has been marked as a duplicate of this bug. ***
Comment 33 Davor Cubranic 2011-10-07 22:14:26 UTC
I still see this bug with KMail 1.13.6 (KDE 4.6.5 on KUbuntu 11.04). I can see the attachment when I view the message as source, and the entire message saves fine (I'll attach it to the bug afterwards), but the attachment saves with zero length. The same attachment saves fine with pine.

The original message was on IMAP, FWIW.
Comment 34 Davor Cubranic 2011-10-07 22:15:29 UTC
Created attachment 64323 [details]
Message whose attachment saves as an empty file
Comment 35 Davor Cubranic 2011-10-07 22:49:12 UTC
Interestingly, when I used Kmail File->Open menu to open the .mbox file I attached above, the attachment saves correctly. It could be some kind of interaction of the format of the message and the IMAP server where it was stored originally. 

Still, this also shows that KMail had the full contents of the message but for some reason could not save the attachment correctly.
Comment 36 Björn Bidar (Thaodan) 2022-09-23 15:04:06 UTC
I can confirm that the issue is still present in Kmail 5.21.1 (KDE Platform 22.08.1).

My imap server is Dovecot.