the-djmaze / snappymail

Simple, modern & fast web-based email client
https://snappymail.eu
GNU Affero General Public License v3.0
1.02k stars 122 forks source link

[CardDav] Snappymail remove photos of my contacts when synchronizing #679

Closed Massedil closed 1 year ago

Massedil commented 1 year ago

Describe the bug Snappymail remove photos of my contacts when synchronizing.

To Reproduce Steps to reproduce the behavior:

  1. Go to Contacts
  2. Click on Synchronize (CardDav)

Snappymail update nearly all contacts it knows (why ?), but it destroys information :

Before :

BEGIN:VCARD
VERSION:3.0
PRODID:+//IDN bitfire.at//DAVx5/3.3.5-ose ez-vcard/0.11.0
UID:ZZZZZ
FN:AAAAA BBBBB
N:;AAAAA BBBBB;;;
PHOTO;ENCODING=b;TYPE=jpeg: [...]
REV:2020-11XXXXX
TEL;TYPE=cell:+32 494 58 96 06
END:VCARD

After :

BEGIN:VCARD
VERSION:4.0
PRODID:SnappyMail-2.19.7
UID:ZZZZZ
FN:AAAAA BBBBB
N:;AAAAA BBBBB;;;
REV:202011XXXXX
TEL;TYPE=cell:+XXXXX
X-CRYPTO;ALLOWED="PGP/INLINE,PGP/MIME,S/MIME,S/MIMEOpaque";ENCRYPTPREF=Ask;
 SIGNPREF=Ask:allowed=PGP/INLINE
END:VCARD

New field :

Updated field :

Lost data :

Expected behavior

Please complete the following information:

the-djmaze commented 1 year ago

X-CRYPTO is a field used by Kmail/Kolab to specify if the contact wants emails encrypted or not. Because SnappyMail supports PGP the fields are added when editing the contact in SnappyMail.

Removing the PHOTO property should not happen, so i wonder why Sabre or SnappyMail removes it. I will try to test this.

the-djmaze commented 1 year ago

PHOTO problem is caused by v3 vs v4.

v3 = PHOTO;ENCODING=b;TYPE=jpeg:… v4 = PHOTO:data:image/jpeg;base64,…

When SnappyMail received a remote vCard, it didn't check the VERSION and PHOTO properly. Then vCard is put back as VERSION = 4.0 which causes an invalid PHOTO value.

I've added a check and a converter to v4

RFC 2426 v3 1998 RFC 6350 v4 2011

Massedil commented 1 year ago

Thanks !

Is it fixed for all V3 property with your update or it is possible it happens for another property?

Can the V3 to V4 conversion have an impact on other clients?

By the way, is it possible to display the contact photo on the contact list and on emails if present?

the-djmaze commented 1 year ago

If clients don't support v4 then it would have issues with the PHOTO value and fail. Since v4 is already available for a very long time, i doubt other clients didn't update.

Eventually the image (also BIMI) might get added at some places.