Bug 280026 - Incorrect size of Base64 encoded attachment
Summary: Incorrect size of Base64 encoded attachment
Status: RESOLVED FIXED
Alias: None
Product: kmail2
Classification: Applications
Component: composer (show other bugs)
Version: 4.7
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-13 13:46 UTC by Patrick
Modified: 2012-01-27 09:02 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.8.1


Attachments
Patch for kmime_content.cpp to fix this issue (911 bytes, patch)
2012-01-27 01:31 UTC, Thomas Kear
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick 2011-08-13 13:46:00 UTC
Version:           4.7 (using KDE 4.7.0) 
OS:                Linux

The size of a Base64 encoded attachment shown in the attachment overview of the composer is incorrect. The size is apparently calculated as 75% of the original file size, but this is incorrect. A Base64 encoded file is 33% larger than the  file it is created from.

Reproducible: Always

Steps to Reproduce:
1. Create a new email (open a composer window).
2. Choose 'Attach File' from the 'Attach' menu.
3. Select a binary file and remember the file size.
4. Compare the file size shown in the attachment overview with the real size.

Actual Results:  
The file size shown in the attachment overview is 75% of the original file size.

Expected Results:  
Either the original file size or the size after Base64 encoding should be shown.
Comment 1 Médéric Boquien 2011-08-27 17:12:07 UTC
I confirm that i get the exact same problem.
Comment 2 Thomas Kear 2012-01-27 01:31:06 UTC
Created attachment 68218 [details]
Patch for kmime_content.cpp to fix this issue

Still appears broken in 4.8.0.  Hopefully this patch is the right approach to fixing it.

Rather than simply changing the existing logic from the current size*3/4 to size*4/3 I've used the maxEncodedSizeFor method from Base64Codec for a hopefully more accurate estimate.
Comment 3 Laurent Montel 2012-01-27 09:02:18 UTC
Git commit d6eac430bd23c0552b3b768305f21348c457d088 by Montel Laurent.
Committed on 27/01/2012 at 10:01.
Pushed by mlaurent into branch 'master'.

Fix Bug 280026 - Incorrect size of Base64 encoded attachment

Apply patch from thomas.kear@gmail.com

FIXED-IN: 4.8.1
CCMAIL: thomas.kear@gmail.com

M  +2    -1    kmime/kmime_content.cpp

http://commits.kde.org/kdepimlibs/d6eac430bd23c0552b3b768305f21348c457d088
Comment 4 Laurent Montel 2012-01-27 09:02:45 UTC
Git commit d9ec6fa8da51a367896b9ab8c2f1a75784b33499 by Montel Laurent.
Committed on 27/01/2012 at 10:01.
Pushed by mlaurent into branch 'KDE/4.8'.

Fix Bug 280026 - Incorrect size of Base64 encoded attachment

Apply patch from thomas.kear@gmail.com

FIXED-IN: 4.8.1
CCMAIL: thomas.kear@gmail.com
(cherry picked from commit d6eac430bd23c0552b3b768305f21348c457d088)

M  +2    -1    kmime/kmime_content.cpp

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