Android: Make vcard version of auto backup of contacts compatible with Nextcloud contacts (min vCard 3.0)

Created on 24 Oct 2019  路  12Comments  路  Source: nextcloud/android

Actual behaviour

Contacts exported by the automatic backup are all reported as being vCard version 2.1 which is incompatible with cardDav servers, and thus show as needing fixing by the Nextcloud contacts app. (See the start of the error message in the log)

Expected behaviour

VCF file exported by automatic backup should import without error into the Nextcloud contacts app.

Steps to reproduce

  1. Turn on automatic contact backups in the Nextcloud android app
  2. Choose import from the Nextcloud contacts app

Environment data

Android version:
9

Device model:
Samsung Galaxy A8

Stock or customized system:
Stock

Nextcloud app version:
3.7.0

Nextcloud server version:
15.0.10

Logs

Nextcloud error log

```

[webdav] Fatal: Sabre\DAV\Exception\UnsupportedMediaType: Validation error in vCard: CardDAV servers are not allowed to accept vCard 2.1. at <>

  1. /var/www/nextcloud/3rdparty/sabre/dav/lib/CardDAV/Plugin.php line 316
    validateVCard("BEGIN:VCARD\r\n ... n", false)
  2. <>
    beforeCreateFile("addressbooks/us ... f", "BEGIN:VCARD\r\n ... n", OCA\DAV\CardDAV\AddressBook {}, false)
  3. /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([OCA\DAV\CardDAV ... "], ["addressbooks/u ... e])
  4. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1094
    emit("beforeCreateFile", ["addressbooks/u ... e])
  5. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 525
    createFile("addressbooks/us ... f", "BEGIN:VCARD\r\n ... n", null)
  6. <>
    httpPut(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
  7. /var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php line 105
    call_user_func_array([Sabre\DAV\CorePlugin {},"httpPut"], [Sabre\HTTP\Requ ... }])
  8. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 479
    emit("method:PUT", [Sabre\HTTP\Requ ... }])
  9. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 254
    invokeMethod(Sabre\HTTP\Reque ... "}, Sabre\HTTP\Response {})
  10. /var/www/nextcloud/apps/dav/lib/Server.php line 301
    exec()

    1. /var/www/nextcloud/apps/dav/appinfo/v2/remote.php line 35

      exec()

    2. /var/www/nextcloud/remote.php line 163

      require_once("/var/www/nextcl ... p")

PUT /remote.php/dav/addressbooks/users/MYUSERNAME/contacts/FILENAME.vcf
from 192.168.0.14 by MYUSERNAME at 2019-10-24T17:26:03+00:00```

approved bug pr exists

Most helpful comment

@sephrat @Bugsbane fix will ship with 3.10 馃帀

All 12 comments

@georgehrke @GretaD @skjnldsv can this be fixed on the server side? If not which vCard version would be needed.

Also pinging @tobiasKaminsky for feedback as there miht be a good reason for the client to export to vCard 2.1.

I have the same issue.
No contact is created on the server side after the sync. Manually importing the exported .vcf in the web interface generates said error.
No feedback is given in the app about an error in the process.

Android v3.8.1
NC server 17.0.0.

@sephrat Do you get the same error message in your Nextcloud logs?

@sephrat Do you get the same error message in your Nextcloud logs?

It's actually in Nextcloud logs that I saw the error message (same as OP). There is no error message in the app.
Edit: just noticed you're OP.... yes I'm getting the same error message as you.

This request did not receive an update in the last 4 weeks. Please take a look again and update the issue with new details, otherwise the issue will be automatically closed in 2 weeks. Thank you!

@georgehrke @GretaD @skjnldsv can this be fixed on the server side? If not which vCard version would be needed.

Also pinging @tobiasKaminsky for feedback as there might be a good reason for the client to export to vCard 2.1.

Nextcloud contacts does not support vCard2.1.
Minimum version is vCard 3.0: https://github.com/nextcloud/contacts/issues/990#issuecomment-563121615

@tobiasKaminsky please see latest comments. Server-side only support vCard 3.x+ while the Android clients exports 2.1, so we need to bump the export to 3.x+.

@tobiasKaminsky checked the code, we get 2.1 from Android itself so we would need to port something like https://github.com/jowave/vcard2to3 (written to do this in python from converting vcfs from Android for Nextcloud)

@tobiasKaminsky Ezvcard should be able to do this, test implementation: #5181

@Bugsbane @sephrat @BernieO can you please give the QA build (should arrive in #5181 by tomorrow) a test drive and report back if this works for you? Any test&feedback is highly appreciated 鉂わ笍

can you please give the QA build (should arrive in #5181 by tomorrow) a test drive and report back if this works for you? Any test&feedback is highly appreciated 鉂わ笍

Sorry, I'd love to do that, but I don't use Android at all. I just stumbled over this searching for a solution for similar problem (https://github.com/BernieO/calcardbackup/issues/25) and thought I'd provide some useful information.

@sephrat @Bugsbane fix will ship with 3.10 馃帀

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eppfel picture eppfel  路  3Comments

rainer042 picture rainer042  路  3Comments

AndyScherzinger picture AndyScherzinger  路  3Comments

JSoko picture JSoko  路  3Comments

Tie-fighter picture Tie-fighter  路  3Comments