Bug 308480 - vCards get imported/exported with incorrect Photo Format Type
Summary: vCards get imported/exported with incorrect Photo Format Type
Status: RESOLVED FIXED
Alias: None
Product: kdepimlibs
Classification: Applications
Component: kabc (show other bugs)
Version: GIT (master)
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-16 10:05 UTC by fetzer.ch
Modified: 2012-11-10 00:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.3
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fetzer.ch 2012-10-16 10:05:47 UTC
When adding images to the contact resource in akonadi (via KAddressBook) the Photo Format Type in the PHOTO tag is set incorrectly. It uses a mime type representation ("image/jpeg" or "image/png").
For example: PHOTO;ENCODING=b;TYPE=image/jpeg:/9j/4AAQSkZJR...

This is wrong for vCard 2.1 and 3.0. It says in the vCard 3.0 spec: 'The TYPE parameter values MUST be one of the IANA registered image formats or a non-standard image format.' 
(see here: vCard 2.1: http://www.imc.org/pdi/vcard-21.doc, page 10; 3.0: http://www.rfc-editor.org/rfc/rfc2426.txt, page 9).
Correct would be: PHOTO;ENCODING=b;TYPE=JPEG:/9j/4AAQSkZJR...

The problem seems to be in VCardTool::createPicture(...) (vcardtool.cpp:854) but I'm not sure if fixing it here is enough.

Reproducible: Always

Steps to Reproduce:
1. Open KAddressBook and add a photo to a contact
2. Open Aconadi Console, switch to browser and select your contact resource
3. Select the relevant vcf file and see it's 'Raw Payload'
Actual Results:  
The raw payload shows:
PHOTO;ENCODING=b;TYPE=image/jpeg:/9j/4AAQSkZJR...

Expected Results:  
While it should actually be:
PHOTO;ENCODING=b;TYPE=JPEG:/9j/4AAQSkZJR...

The issue prevents for example proper syncing with syncevolution.
Comment 1 Laurent Montel 2012-10-16 10:35:06 UTC
Git commit f7de08b9f65e2c7414f237dda9e024ebcdbccd31 by Montel Laurent.
Committed on 16/10/2012 at 12:34.
Pushed by mlaurent into branch 'KDE/4.9'.

Fix Bug 308480 - vCards get imported/exported with incorrect Photo

Format Type

FIXED-IN: 4.9.3

M  +2    -2    kabc/vcardtool.cpp

http://commits.kde.org/kdepimlibs/f7de08b9f65e2c7414f237dda9e024ebcdbccd31
Comment 2 Laurent Montel 2012-10-16 10:35:28 UTC
I tested and works fine now.
Regards
Comment 3 fetzer.ch 2012-10-16 11:39:34 UTC
That was quick. Thanks!

Had a look into the vCard 4.0 spec: http://www.rfc-editor.org/rfc/rfc6350.txt (p. 29)
They changed the tags here and also switched to mime types.
Maybe something to consider later when adding 4.0 support.

Example:
PHOTO:data:image/jpeg;base64,MIICajCCAdOgAwIBAgICBEUwDQYJKoZIhv
AQEEBQAwdzELMAkGA1UEBhMCVVMxLDAqBgNVBAoTI05ldHNjYXBlIENvbW11bm
ljYXRpb25zIENvcnBvcmF0aW9uMRwwGgYDVQQLExNJbmZvcm1hdGlvbiBTeXN0
<...remainder of base64-encoded data...>
Comment 4 Laurent Montel 2012-10-16 11:56:45 UTC
For the moment we don't have support for vcard4.0
Don't know if a program has this support.
Thunderbird still uses vcard 2.1
Comment 5 Thomas Tanghus 2012-11-10 00:00:09 UTC
(In reply to comment #0)
> When adding images to the contact resource in akonadi (via KAddressBook) the
> Photo Format Type in the PHOTO tag is set incorrectly. It uses a mime type
> representation ("image/jpeg" or "image/png").
> For example: PHOTO;ENCODING=b;TYPE=image/jpeg:/9j/4AAQSkZJR...
> Correct would be: PHOTO;ENCODING=b;TYPE=JPEG:/9j/4AAQSkZJR...

Dang, I had misread the rfc there. That is perhaps the reason for the the bug reports where I blamed the SoGo connector in connection with ownCloud. KDEPIM/Android/N900/N9(50) reads the profile pictures just fine with the full mimetype, so I automatically blamed Evolution/Thunderbird/Sogo :-P