Page MenuHomekolab.org

iRony CardDAV: ContactsBackend.php does not handle v4 PHOTO properties
Closed, ResolvedPublic

Description

[root@mail CardDAV]# rpm -qv pykolab iRony kolab
pykolab-0.8.6-2.1.el7.kolab_16.noarch
iRony-0.4-1.28.el7.kolab_16.noarch
kolab-16.0.1-4.3.el7.kolab_16.x86_64

Personal use case: Android 6.0 w/ DAVdroid 1.3.4.1-ose, setting images on contacts

ContactsBackend.php does not handle v4 PHOTO properties, which produces the following error in: /var/log/iRony/errors:

[06-Dec-2016 15:55:16 America/New_York] PHP Fatal error:  Call to a member function getValue() on a non-object in /usr/share/iRony/lib/Kolab/CardDAV/ContactsBackend.php on line 991

I belive the error is due to this code not handling PHOTO:data:image/jpeg;base64, well:

989                 case 'PHOTO':
990                     $param = $prop->offsetGet('encoding') ?: $prop->parameters[0];
991                     if (($pvalue = $param->getValue()) && (strtolower($pvalue) == 'b' || strtolower($pvalue) == 'base     64') || strtolower($param->name) == 'base64') {
992                         $contact['photo'] = $value;
993                     }
994                     break;

PHOTO spec https://en.wikipedia.org/wiki/VCard:

2.1: PHOTO;JPEG:http://example.com/photo.jpg
2.1: PHOTO;JPEG;ENCODING=BASE64:[base64-data]
3.0: PHOTO;TYPE=JPEG;VALUE=URI:http://example.com/photo.jpg
3.0: PHOTO;TYPE=JPEG;ENCODING=b:[base64-data]
4.0: PHOTO;MEDIATYPE=image/jpeg:http://example.com/photo.jpg
4.0: PHOTO:data:image/jpeg;base64,[base64-data]

Event Timeline

mgoodwin created this task.Dec 6 2016, 10:42 PM
mgoodwin updated the task description. (Show Details)Dec 6 2016, 10:46 PM

My personal workaround was to comment out 989-994 so that the rest of my contacts and properties actually sync.

Roundcube core and kolab_addressbook plugin does not support photo URLs. It is not clear to me if it is at all possible to store URL and mediatype in Kolab XML format (probably only URL without type is supported).

That's why I think it will be fine if we just ignore them and make sure fatal errors are not thrown. In the above list only these two do not cause errors:

PHOTO;JPEG;ENCODING=BASE64:[base64-data]
PHOTO;TYPE=JPEG;ENCODING=b:[base64-data]

I came across this issue yesterday and the above patch appears to fix the problem for me. Please merge it into the iRony repository.