On Thu, 2012-08-09 at 20:42 +0200, Patrick Ohly wrote:
> On Thu, 2012-08-09 at 15:18 +0200, Vladimir Elisseev wrote:
> > Hello,
> > 
> > I'm having some issues with synchronizing photos. In my setup I'm using
> > Funambol as a server, clients are Syncevolution and Funambol for
> > android. The problem appears in the following case:
> > 1. the "Test" contact has been modified on the android device (any field
> > besides photo)
> > 2. syncing with syncevolution gives a lot of lines with the same warning
> > "[WARNING] libebook: invalid character found in parameter spec", but
> > synchronization completed "successfully" and... photo's gone.
> 
> What is you version of Evolution?
> 
> To debug this further, please reproduce the issue while running with
> loglevel=4. Then send me the syncevolution-log.html of the session where
> the photo was removed to patrick.ohly at gmx.de.

The Funambol Android app and/or the Funambol server send an invalid TYPE
for the PHOTO. Here's what is sent to SyncEvolution:

BEGIN:VCARD
VERSION:2.1
...
PHOTO;ENCODING=BASE64;TYPE=image/jpeg:
 /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAIBAQEBAQIBAQECAgICAgQDAgICAgUEBAMEBgUGBgY
...

This seems to throw off the vCard parser in libebook.

Instead of sending a mime type, correct would be:

        Photo Format Type
        This property parameter is provided to specify the graphics
        format for the Photo property value. The property parameter
        includes the following values:
        
        [...]
        
        Indicates ISO JPEG format
        JPEG

vCard 3.0 makes this more explicit and refers to
http://www.iana.org/assignments/media-types/image/index.html which again
uses "jpeg" and not "image/jpeg".

Attached is a patch that hopefully works around the issue. It's untested
because I cannot trigger this behavior.

Can you apply the attached patch to your SyncEvolution installation as
follows?

$ sudo su
# cd /usr/share/syncevolution/xml
# patch -p4 </tmp/photo-type.patch
patching file datatypes/02vcard-types.xml
patching file scripting/04vcard-photo-value.xml

Then try again with loglevel=4 as you did before. If it helps, great, if
not, please send me the log file.

-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.

diff --git a/src/syncevo/configs/datatypes/02vcard-types.xml b/src/syncevo/configs/datatypes/02vcard-types.xml
index 226af99..41c2172 100644
--- a/src/syncevo/configs/datatypes/02vcard-types.xml
+++ b/src/syncevo/configs/datatypes/02vcard-types.xml
@@ -7,6 +7,7 @@
      <incomingscript><![CDATA[
         $VCARD_INCOMING_NAMECHANGE_SCRIPT
         $VCARD_INCOMING_PHOTO_VALUE_SCRIPT
+        $VCARD_INCOMING_PHOTO_TYPE_SCRIPT
       ]]></incomingscript>
       <outgoingscript><![CDATA[
         $VCARD_OUTGOING_ADDREV_SCRIPT
@@ -22,6 +23,7 @@
       <incomingscript><![CDATA[
         $VCARD_INCOMING_NAMECHANGE_SCRIPT
         $VCARD_INCOMING_PHOTO_VALUE_SCRIPT
+        $VCARD_INCOMING_PHOTO_TYPE_SCRIPT
       ]]></incomingscript>
       <outgoingscript><![CDATA[
         $VCARD_OUTGOING_ADDREV_SCRIPT
diff --git a/src/syncevo/configs/scripting/04vcard-photo-value.xml b/src/syncevo/configs/scripting/04vcard-photo-value.xml
index 7981aa3..d3a4064 100644
--- a/src/syncevo/configs/scripting/04vcard-photo-value.xml
+++ b/src/syncevo/configs/scripting/04vcard-photo-value.xml
@@ -10,6 +10,15 @@
       }
     ]]></macro>
 
+    <macro name="VCARD_INCOMING_PHOTO_TYPE_SCRIPT"><![CDATA[
+      // Fix PHOTO TYPE=image/jpeg (sent by Funambol).
+      INTEGER pos;
+      pos = RFIND(PHOTO_TYPE, "/");
+      if (pos != UNASSIGNED) {
+          PHOTO_TYPE = SUBSTR(PHOTO_TYPE, pos + 1);
+      }
+    ]]></macro>
+
     <macro name="VCARD_OUTGOING_PHOTO_VALUE_SCRIPT"><![CDATA[
       // Ensure that PHOTO_VALUE == "binary" is not sent (it's the default).
       if (PHOTO_VALUE == "binary") {
_______________________________________________
SyncEvolution mailing list
[email protected]
http://lists.syncevolution.org/listinfo/syncevolution

Reply via email to