Support for values with double-quotes and newlines (RFC 6868)



  • Ok, I went through ALL my contacts and found one with " in it. It’s very weird because is a very old contract that was very recently imported from the server because I reflashed the phone recently, so the " imported by DAVdroid without any problems. I updated the picture of that contact, and when DAVdroid want to upload the updated contact, then I got the error. I don’t know exactly where, but this really looks like a bug somewhere.

    Thanks!


  • developer

    I updated the picture of that contact, and when DAVdroid want to upload the updated contact, then I got the error. I don’t know exactly where, but this really looks like a bug somewhere.

    Did you import it locally or over CardDAV? It shouldn’t be possible to transmit " over CardDAV, if I understand it correctly.



  • Did you import it locally or over CardDAV? It shouldn’t be possible to transmit " over CardDAV, if I understand it correctly.

    I had my phone without any contacts, I installed and configured DAVdroid, I synced the phone and I got this contact with a " in it.


  • developer

    Did you have a look at the logs to find the contact? Would be interesting how to VCard had looked like.



  • @rfc2822 said in Error while uploading created/modified entries:

    Did you have a look at the logs to find the contact?

    No, I went through every contact manually. I posted the log in here, I could find any mention to the contact, I think it would be useful to print the contact info in the debug output when this happens.

    Would be interesting how to VCard had looked like.

    I saw no information in the logs but what I posted here.


  • developer

    @llucax Yes, when uploading, there’s still no traffic and log. But when you download the contacts, there’s HTTP traffic and you can see what has been downloaded — which would be quite interesting, because it should not be possible to encode " in VCards, so I wonder how you could download it as VCard without an error …



  • Well, this contact was downloaded ages ago, but I can change it in the server and see what happens. My suggestion still applies though, right now is impossible to see which contact failed, and you can reproduce this problem by just modifying a contact adding a " in the address (I just verified I van make it fail again by adding a " in the address of any contact), which is quite bad.


  • developer

    @llucax What happens when you change it on the server to something with "?



  • @rfc2822 said in Error while uploading created/modified entries:

    @llucax What happens when you change it on the server to something with "?

    Yes, it works perfectly. This is what DAVdroid receives in the address according to the log:

    ADR;LABEL=Humberto Primo Dto. 18  \n ;TYPE=home:;;Humberto Primo Dt
     o. 18";;;;
    


  • The text that appears in the contact view is

    Humberto Primo 639 Dto. 18"
    

  • developer

    @llucax Is it a VCard VERSION:3 or VERSION:4?



  • VERSION:4.0
    PRODID:-//Sabre//Sabre VObject 3.5.0//EN
    

  • developer

    @llucax Thanks. So the whole problem can be split into two parts:

    1. Your server sends an invalid VCard. According to RFC 6350, »property parameter values must not contain the DQUOTE (U+0022) character« (details in the RFC, see the definition of ADR LABEL as param-value, and param-value can’t contain "). Because of this server bug, the address could be imported over CardDAV and cause further problems. Will you report that to OwnCloud? A possible solution could be to use RFC 6868, see below.
    2. The second problem is that values with " can’t be uploaded over CardDAV/VCard, although they may appear in Android’s local contact storage. So, the user should either be notified about this (like you were), or DAVdroid should be able to deal with this in a standard-compliant way. I have just found that RFC 6868 provides a way to escape ", but I’m not sure how wide-spread this solution is. I’ll investigate. In the meanwhile, DAVdroid won’t synchronize " over VCard because it’s not possible.


  • @rfc2822 said in Error while uploading created/modified entries:

    @llucax Thanks. So the whole problem can be split into two parts:

    1. Your server sends an invalid VCard. According to RFC 6350, »property parameter values must not contain the DQUOTE (U+0022) character« (details in the RFC, see the definition of ADR LABEL as param-value, and param-value can’t contain "). Because of this server bug, the address could be imported over CardDAV and cause further problems. Will you report that to OwnCloud? A possible solution could be to use RFC 6868, see below.

    I will report to owncloud.

    1. The second problem is that values with " can’t be uploaded over CardDAV/VCard, although they may appear in Android’s local contact storage. So, the user should either be notified about this (like you were), or DAVdroid should be able to deal with this in a standard-compliant way. I have just found that RFC 6868 provides a way to escape ", but I’m not sure how wide-spread this solution is. I’ll investigate. In the meanwhile, DAVdroid won’t synchronize " over VCard because it’s not possible.

    I think at a bare minimum the information about which contact is the problematic one should be provided. The, maybe it could be a DAVdroid option if you want to:

    1. Automatically convert to another char (default to ’ but make it configurable too)
    2. Complain (default)
    3. Use RFC 6868



  • developer

    @llucax Thanks for reporting that to OwnCloud.

    If we make an option for handling double-quotes in VCards, we surely can’t call DAVdroid “lightweight” anymore. I guess the way to go is RFC 6868 (I’ll investigate, report to ez-vcard etc.), but until then, double-quotes will not be supported.



  • @rfc2822 what about at least providing useful debug message until this is solved?


  • developer

    @llucax Information about which contact/event/task is being prepared for upload is now shown in the logs.


  • developer

    Turned out that ez-vcard already has RFC 6868 support, but it’s disabled for writing VCards by default.

    RFC 6868 support is now enabled in DAVdroid. Seems that putting " into an address label now works and can even be parsed by OwnCloud.



  • Great! Thanks a lot!


Log in to reply
 

Similar topics