Creating or editing contacts with pictures over CardDav breaks the contact

Hi,

This is the biggest problem I’ve faced during the trial period.
emClient: 6.0.22344.0
ownCloud: 8.1.0 (stable)

I’m using ownCloud purely as a CalDav and CardDav server.  This works fine with my iPhone/iPad and I’m experiencing no problems modifying contacts.

To reproduce the problem I start with no contacts defined at all in my CardDav server, and ensure I can sync correctly with emClient.

  1. Create a new contact
  2. Click Save
    The contact briefly appears, flashes the disappears as it syncs with ownCloud

However if I create a contact without a picture

then when I click save it’s correctly stored:
![](https://d2r1vs3d9006ap.cloudfront.net/s3_images/1243522/RackMultipart20150724-13978-zthomi-contact no_pic after_inline.png?1437761118 “Image https//d2r1vs3d9006apcloudfrontnet/s3_images/1243522/RackMultipart20150724-13978-zthomi-contact__no_pic__after_inlinepng1437761118”)

for completeness this is what I see in ownCloud afterwards

Note the T by Test Contact 2 is the default avatar, the white space by Test Contact is unusual though, suggesting something was sent as an image, but not something that could be used by ownCloud.

Now you might shift the blame towards owncloud, however my Apple products can create and edit contacts with pictures easily and repatedly.  I can even sync them back into emClient, however if I edit them in any way with emClient the same thing happens and the avatars disappear (although sometimes the contact remains, just without an avatar).

Looking at the CardDav logs I can see a few things of interest.

Firstly, here’s the second contact log, without picture - nothing particularly interesting:

18:57:09.388|015|   C: PutCommand [http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8...](http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8de959ff62c2.vcf "Link http//1921681124/owncloud/remotephp/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8de959ff62c2vcf")

18:57:09.388|015|   BEGIN:VCARD

18:57:09.388|015|   VERSION:4.0

18:57:09.388|015|   UID:urn:uuid:0644e2a5-7aef-412a-82e9-06ae6960a03a

18:57:09.388|015|   N;SORT-AS="Test Contact 2":2;Test,Contact;;

18:57:09.388|015|   FN:Test Contact 2

18:57:09.388|015|   PRODID:-//eM Client/6.0.22344.0

18:57:09.388|015|   END:VCARD

18:57:09.388|015|   

18:57:09.791|015|   S: PUT [http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8...](http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8de959ff62c2.vcf "Link http//1921681124/owncloud/remotephp/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8de959ff62c2vcf")

18:57:09.791|015|   Created Created

18:57:09.793|015|   C: GetCommand [http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8...](http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8de959ff62c2.vcf "Link http//1921681124/owncloud/remotephp/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8de959ff62c2vcf")

18:57:10.034|015|   S: GET [http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8...](http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8de959ff62c2.vcf "Link http//1921681124/owncloud/remotephp/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8de959ff62c2vcf")

18:57:10.034|015|   OK OK

18:57:10.034|015|   ETag: "bb5b094dfc5bb09cb715ddc2c5a207ae"

18:57:10.034|015|   Response, stream length: 

-1, 233

18:57:10.034|015|   Content: 

BEGIN:VCARD

18:57:10.034|015|   VERSION:3.0

18:57:10.034|015|   UID:urn:uuid:0644e2a5-7aef-412a-82e9-06ae6960a03a

18:57:10.034|015|   N;SORT-AS=Test Contact 2:2;Test\,Contact;;;

18:57:10.034|015|   FN:Test Contact 2

18:57:10.034|015|   PRODID:-//ownCloud//NONSGML Contacts 0.4.0.0//EN

18:57:10.034|015|   REV:2015-07-24T17:57:05+00:00

18:57:10.034|015|   END:VCARD

18:57:10.034|015|   

But the log from when I created a contact with avatar:

18:52:13.018|015|   S: PROPFIND [http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/](http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/ "Link http//1921681124/owncloud/remotephp/carddav/addressbooks/rob/contacts/")

18:52:13.018|015|   207 Multi-Status

18:52:13.018|015|   Response, stream length: 

-1, 260

18:52:13.018|015|   Content: 

<?xml version="1.0" encoding="utf-8"?>

<multistatus xmlns:d="DAV:" xmlns:s="&lt;a href=" http: rel="nofollow" target="_blank">http://sabredav.org/ns"; xmlns:card="urn:ietf:params:xml:ns:carddav"&gt;<response><href>/owncloud/remote.php/carddav/addressbooks/rob/contacts/</href></response></multistatus>


18:52:13.018|015|&nbsp;&nbsp; SynchronizeItemsCommand finished on ( /ACCOUNT:5)

18:52:15.589|015|&nbsp;&nbsp; SynchronizeFoldersCommand executing on ( /ACCOUNT:5)

18:53:32.096|015|&nbsp;&nbsp; C: PutCommand [http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-3...](http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-37753bf0ce6e.vcf "Link http//1921681124/owncloud/remotephp/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-37753bf0ce6evcf")

18:53:32.096|015|&nbsp;&nbsp; BEGIN:VCARD

18:53:32.096|015|&nbsp;&nbsp; VERSION:4.0

18:53:32.096|015|&nbsp;&nbsp; UID:urn:uuid:5189946f-f200-4895-bc6b-d77957663ab5

18:53:32.096|015|&nbsp;&nbsp; N;SORT-AS="Test Contact":Contact;Test;;

18:53:32.096|015|&nbsp;&nbsp; FN:Test Contact

18:53:32.096|015|&nbsp;&nbsp; PHOTO:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAR4AAACrCAMAAACHZwOWAAAA

18:53:32.096|015|&nbsp;&nbsp;&nbsp; AXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURQgIITExCAgQMYylENbeGCkpCM7WEJy

[snip Base 64 encoded image]

18:53:32.099|015|&nbsp;&nbsp; PRODID:-//eM Client/6.0.22344.0

18:53:32.099|015|&nbsp;&nbsp; END:VCARD

18:53:32.099|015|&nbsp;&nbsp; 

18:53:32.613|015|&nbsp;&nbsp; S: PUT [http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-3...](http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-37753bf0ce6e.vcf "Link http//1921681124/owncloud/remotephp/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-37753bf0ce6evcf")

18:53:32.613|015|&nbsp;&nbsp; Created Created

emClient then retrieves the contact

18:53:32.618|015|&nbsp;&nbsp; C: GetCommand [http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-3...](http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-37753bf0ce6e.vcf "Link http//1921681124/owncloud/remotephp/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-37753bf0ce6evcf")

18:53:32.994|015|&nbsp;&nbsp; S: GET [http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-3...](http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-37753bf0ce6e.vcf "Link http//1921681124/owncloud/remotephp/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-37753bf0ce6evcf")

18:53:32.994|015|&nbsp;&nbsp; OK OK

18:53:32.994|015|&nbsp;&nbsp; ETag: "97105d87ccca56872a94f354a9de8de0"

18:53:32.996|015|&nbsp;&nbsp; Response, stream length: 

-1, 40069

18:53:32.996|015|&nbsp;&nbsp; Content: 

BEGIN:VCARD

18:53:32.996|015|&nbsp;&nbsp; VERSION:3.0

18:53:32.996|015|&nbsp;&nbsp; UID:urn:uuid:5189946f-f200-4895-bc6b-d77957663ab5

18:53:32.996|015|&nbsp;&nbsp; N;SORT-AS=Test Contact:Contact;Test;;;

18:53:32.996|015|&nbsp;&nbsp; FN:Test Contact

18:53:32.996|015|&nbsp;&nbsp; PHOTO: **dataimage/pngbase64** iVBORw0KGgoAAAANSUhEUgAAAR4AAACrCAMAAACHZwOWAAAAAX

18:53:32.996|015|&nbsp;&nbsp;&nbsp; NSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURQgIITExCAgQMYylENbeGCkpCM7WEJyt

[snip Base 64 encoded image]

18:53:32.998|015|&nbsp;&nbsp; PRODID:-//ownCloud//NONSGML Contacts 0.4.0.0//EN

18:53:32.998|015|&nbsp;&nbsp; REV:2015-07-24T17:53:28+00:00

18:53:32.998|015|&nbsp;&nbsp; END:VCARD

please not the returned
" PHOTO:dataimage/pngbase64"
is not the same as what was sent
" PHOTO:data:image/png;base64,"

again if my iphone/ipad didn’t work I’d assume it was an ownCloud problem, but this only goes wrong when I use emClient.

I’d appreciate any help with this as it’s a show-stopper for me paying and moving over to emClient as my outlook replacement.

Cheers,
Rob

gosh, the “pre” tag made a total pigs-ear of the log output, and I can now no longer edit the post…

Here’s the log for uploading/downloading Test Contact 2 (without pic) that worked fine:

18:57:09.388|015|   C: PutCommand http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8…
18:57:09.388|015|   BEGIN:VCARD
18:57:09.388|015|   VERSION:4.0
18:57:09.388|015|   UID:urn:uuid:0644e2a5-7aef-412a-82e9-06ae6960a03a
18:57:09.388|015|   N;SORT-AS=“Test Contact 2”:2;Test,Contact;;
18:57:09.388|015|   FN:Test Contact 2
18:57:09.388|015|   PRODID:-//eM Client/6.0.22344.0
18:57:09.388|015|   END:VCARD
18:57:09.388|015|  
18:57:09.791|015|   S: PUT http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8…
18:57:09.791|015|   Created Created
18:57:09.793|015|   C: GetCommand http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8…
18:57:10.034|015|   S: GET http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/45fa8380-b505-48b6-b921-8…
18:57:10.034|015|   OK OK
18:57:10.034|015|   ETag: “bb5b094dfc5bb09cb715ddc2c5a207ae”
18:57:10.034|015|   Response, stream length:
-1, 233
18:57:10.034|015|   Content:
BEGIN:VCARD
18:57:10.034|015|   VERSION:3.0
18:57:10.034|015|   UID:urn:uuid:0644e2a5-7aef-412a-82e9-06ae6960a03a
18:57:10.034|015|   N;SORT-AS=Test Contact 2:2;Test,Contact;;;
18:57:10.034|015|   FN:Test Contact 2
18:57:10.034|015|   PRODID:-//ownCloud//NONSGML Contacts 0.4.0.0//EN
18:57:10.034|015|   REV:2015-07-24T17:57:05+00:00
18:57:10.034|015|   END:VCARD
18:57:10.034|015|  

Here’s the upload of Test Contact (with picture)

18:53:32.096|015|   C: PutCommand http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-3…
18:53:32.096|015|   BEGIN:VCARD
18:53:32.096|015|   VERSION:4.0
18:53:32.096|015|   UID:urn:uuid:5189946f-f200-4895-bc6b-d77957663ab5
18:53:32.096|015|   N;SORT-AS=“Test Contact”:Contact;Test;;
18:53:32.096|015|   FN:Test Contact
18:53:32.096|015|   PHOTO:data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAR4AAACrCAMAAACHZwOWAAAA
18:53:32.096|015|    AXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMAUExURQgIITExCAgQMYylENbeGCkpCM7WEJy
18:53:32.096|015|    tEGNrEBAYIYSMGK29EBgYCHuMEDE5ACEhCBAQGMbOEEpKCDlCCL3GELXGIc7WIaW1EP//52tzEI
[snip base64 data]
18:53:32.099|015|    gXcNldU119f8BSeRpHAnvmkkAAAAASUVORK5CYII=
18:53:32.099|015|   PRODID:-//eM Client/6.0.22344.0
18:53:32.099|015|   END:VCARD
18:53:32.099|015|  
18:53:32.613|015|   S: PUT http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-3…
18:53:32.613|015|   Created Created

then here is what happens when emClient does an immediate Get

18:53:32.618|015|   C: GetCommand http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-3…
18:53:32.994|015|   S: GET http://192.168.1.124/owncloud/remote.php/carddav/addressbooks/rob/contacts/feb2ba0d-30a5-46b5-8318-3…
18:53:32.994|015|   OK OK
18:53:32.994|015|   ETag: “97105d87ccca56872a94f354a9de8de0”
18:53:32.996|015|   Response, stream length:
-1, 40069
18:53:32.996|015|   Content:
BEGIN:VCARD
18:53:32.996|015|   VERSION:3.0
18:53:32.996|015|   UID:urn:uuid:5189946f-f200-4895-bc6b-d77957663ab5
18:53:32.996|015|   N;SORT-AS=Test Contact:Contact;Test;;;
18:53:32.996|015|   FN:Test Contact
18:53:32.996|015|   PHOTO:dataimage/pngbase64 iVBORw0KGgoAAAANSUhEUgAAAR4AAACrCAMAAACHZwOWAAAAAX
[snip base64 data]
18:53:32.998|015|    8BSeRpHAnvmkkAAAAASUVORK5CYIA==
18:53:32.998|015|   PRODID:-//ownCloud//NONSGML Contacts 0.4.0.0//EN
18:53:32.998|015|   REV:2015-07-24T17:53:28+00:00
18:53:32.998|015|   END:VCARD

Note the difference in the PHOTO tag between what was snet and what was returned.

Hello I can see the difference between the PHOTO tag, but unfortunately the data format your CardDAV server is returning is not valid. The format of the PHOTO tag inside your VCard specification is missing the required, “:” in data format specification. Thus eM Client can’t display the item as it’s in unreadable format.

Please check with your mail server support in order to resolve this issue, eM Client 6 is currently supporting VCard 4, where the photo tag should look like this:

PHOTO:data:image/jpeg;base64,[base64-data]

Hope this helps,

thanks for the update, does this mean emClient does not support version 3.0 of the vcard format, or do you support versions up to 4.0?

We support versions up to 4.0, based on the server response/compatibility.

Regards,

Just to close this off.  ownCloud was using an older version of SabreDAV, which was mangling the vcards.  The latest SabreDAV appears to work fine with em Client

Thank you for following up with us, make sure to let us know if you come across any other issues or questions about the application, we’ll be happy to help.

Regards,