[OwnCloud] Losing contacts after sync with DAVdroid 0.8.1+


  • developer

    It's somewhat related because I wonder how DavDroid would delete contacts if a PROPFIND request doesn't return the requested hrefs.

    I don't understand the question. DAVdroid deletes all local contacts which are not returned by PROPFIND, based on the file name, at the end of the sync process.



  • Sorry, I think I confused PROPFIND with an addressbook-multiget REPORT.

    On 18 July 2015 17:38:27 CEST, rfc2822 notifications@github.com wrote:

    It's somewhat related because I wonder how DavDroid would delete
    contacts if a PROPFIND request doesn't return the requested hrefs.

    I don't understand the question. DAVdroid deletes all local contacts
    which are not returned by PROPFIND, based on the file name, at the end
    of the sync process.


    Reply to this email directly or view it on GitHub:
    https://github.com/bitfireAT/davdroid/issues/578#issuecomment-122556983

    --
    Sent from my phone. Please excuse my brevity.



  • Same problem when I restore my second smartphone.
    Both phones have the same android (4.4.2) and davdroid (8.1) versions.
    On my first smartphone the sync is working perfectly. On my second phone all contacts are deleted after a while.
    On the 2nd phone, when I go in the settings: contacts are sent in vcard 4.0 format (always tick on)
    On the first phone, when I go in the settings: contacts are sent in vcard 3.0 format (always tick off)
    I don't understand why???


  • developer

    @Eddy1979 Without detailed logs, there's no way to analyze your problem. It's very likely that you're hit by the OwnCloud bug discussed here. The two phones probably behave differently because the accounts on the phones were created with different DAVdroid and/or OwnCloud versions. Uninstall and then install DAVdroid again on both phones and they will most likely behave identically. The VCard version of the server is detected when the account is created and shown in the Settings UI (it can't be changed).



  • @rfc2822 thank you for your fast reply.
    If I understand the only one solution is to wait for an OC update. :-(



  • Well, a possible workaround for the bug discussed here is, as mentioned somewhere above, to export all your contacts, make sure the ids do not contain special characters such as '@', and then re-import them into your owncloud.

    On July 24, 2015 1:17:01 PM GMT+02:00, Eddy1979 notifications@github.com wrote:

    @rfc2822 thank you for your fast reply.
    If I understand the only one solution is to wait for an OC update. :-(


    Reply to this email directly or view it on GitHub:
    https://github.com/bitfireAT/davdroid/issues/578#issuecomment-124480698



  • I think I understand now what was irking me about DavDroid's behavior:

    delete every local non-dirty contacts that are not on the server anymore

    The items with @ are being treated inconsistently by DavDroid. First it assumes they're on the server and therefore adds them to the addressbook, later it thinks they are not on the server and deletes them locally.

    So I think the way DavDroid handles invalid multiget-responses such as the one from ownCloud is problematic. Encoding errors happen all the time, and while I don't think DavDroid is in a place to work around those, it should abort sync if:

    • the response contains unsolicited items
    • is missing items that have been requested. Unfortunately Radicale doesn't allow between a finer distinction of 404-status and a missing status. At least not until https://github.com/Kozea/Radicale/pull/259 is widely used.


  • To clear up things: The contacts app is not maintained, the maintainer left the project because of disagreements on how things were decided and communicated back then. I feel that things got better.

    Long story short: this won't be fixed and the code is quite messy. We need someone who wants to fix (very likely rewrite) things and is able to write PHP (and ideally JavaScript, a working sync backend is more important). If someone is interested, I'd offer help to get into ownCloud's PHP API and would help to review code.



  • I'm willing to provide a patch for this particular bug but definetly can't take over maintainership.

    On 25 July 2015 22:39:55 CEST, Bernhard Posselt notifications@github.com wrote:

    To clear up things: The contacts app is not maintained, the maintainer
    left the project because of disagreements with how things were decided
    and communicated back then. I feel that things got better.

    Long story short: this won't be fixed and the code is quite messy. We
    need someone who wants to fix things and is able to write PHP and
    JavaScript. If someone is interested, I'd offer help to get into
    ownCloud's PHP API and would help to review code.


    Reply to this email directly or view it on GitHub:
    https://github.com/bitfireAT/davdroid/issues/578#issuecomment-124889149

    --
    Sent from my phone. Please excuse my brevity.



  • Here is my workaround using @untitaker's owncloud/contacts#1003 pull request. To have an OwnCloud 8.1 synchronising correctly and right now, I directly modified the apps/contacts/lib/carddav/backend.php file, on line 192 I replaced

    'uri' => urlencode($contact['uri']),
    

    by

    'uri' => $contact['uri'],
    

    This may be kind of bully, but it worked for me.



  • I've added the fix in owncloud contacts


  • developer

    @Raydiation Thanks, so I'll close this issue here now.



  • Workaround?

    About the bug in UIDs between DAVDroid/OwnCloud, to get rid of the problem on contacts dispappearing in Android, I:
    1/ exported the Contacts List file as a .vcf (from Owncloud itseld, from Evolution or from Android, doesn't matter).
    2/ Edited this list with the GNU notepad (any other should also work), removing all "@"in the UIDs. (Find/replaceAll)
    3/ Remove all contacts from Owncloud/Contacts web interface, imported back the cleaned .vcf file.

    I didn't really understand from where these "@" in the UIDs came from (I highly suspect contacts created in previous OC versions), tested a new contact creation from Evolution, Android and OwnCloud/Contacts4.0.0. and all the UIDs are clean, so the problem should disappear in the future, thanks to the fix too.

    This might be useful to some people who still have "dirty" UIDs in their contacts files. I'm now on OC8.1.1, DAVDroid 0.8.3 and everything is fine.



  • Exported the contacts, deleted the "@1234..." behind the UIDs and reimported them. Worked like a charm. No more sync errors since then between owncloud and davdroid. Thanks for that great hint!



  • @Raydiation is your fix mentioned in comment 126705900 included in the Release 0.4.0.0 of the Contacts-App? I have difficulties to figure out wether the fix is already included in the current ownCloud release 8.1.1 or not.



  • The contacts app is not included in 8.1. The fix was made a month ago, contacts 4.0.0 was released 2 months ago, so you need to use master until a new release is uploaded to the app store



  • All right. Thanks for your reply.



  • The workaround worked for me too (owncloud 8.1 and davroid 0.8.4).
    Exported the contacts from owncloud, removed with a text editor all the @ part in the UUID and then reimported.
    Thank you



Looks like your connection to Bitfire App Forums was lost, please wait while we try to reconnect.