nextcloud / contacts

📇 Contacts app for Nextcloud
https://apps.nextcloud.com/apps/contacts
GNU Affero General Public License v3.0
570 stars 173 forks source link

Unsupported media type vcard #46

Closed Happyfeet01 closed 7 years ago

Happyfeet01 commented 7 years ago

Since I upgraded to nextcloud 11 beta 2 I can't sync my contacts because of this error:

Sabre\DAV\Exception\UnsupportedMediaType: HTTP/1.1 415 Validation error in vCard: REV MUST NOT appear more than once in a VCARD component

Steps to reproduce

  1. Update from NC 10 to NC 11 beta 2
  2. Install Android davdroid client and set it up 3.try to sync

Expected behaviour

Actual behaviour

Can not sync

Server configuration

Operating system: Ubuntu 16.04 Web server: Apache Database: Mysql PHP version: 7.0.13 Nextcloud version: (see Nextcloud admin page)

Contacts version: (see Nextcloud apps page) 1.5.2 Updated from an older Nextcloud or fresh install: updated Signing status:

Disabled because of modified ca-bundle.crt 

List of activated apps:

Enabled:
  - activity: 2.4.1
  - admin_audit: 1.1.0
  - bookmarks: 0.9.0
  - calendar: 1.4.1
  - comments: 1.1.0
  - contacts: 1.5.2
  - dav: 1.1.1
  - direct_menu: 0.9.3
  - federatedfilesharing: 1.1.1
  - federation: 1.1.1
  - files: 1.6.1
  - files_accesscontrol: 1.1.2
  - files_external: 1.1.2
  - files_pdfviewer: 1.0.1
  - files_sharing: 1.1.1
  - files_trashbin: 1.1.0
  - files_versions: 1.4.0
  - files_videoplayer: 1.0.0
  - firstrunwizard: 2.0
  - gallery: 16.0.0
  - logreader: 1.3.1
  - lookup_server_connector: 1.0.0
  - news: 10.0.0
  - nextcloud_announcements: 1.0
  - notes: 2.0.2
  - notifications: 1.0.1
  - ocdownloader: 1.5
  - password_policy: 1.1.0
  - passwords: 19
  - provisioning_api: 1.1.0
  - rainloop: true
  - richdocuments: 1.1.14
  - serverinfo: 1.1.1
  - sharebymail: 1.0.0
  - survey_client: 0.1.5
  - systemtags: 1.1.3
  - tasks: 0.9.3
  - theming: 1.1.1
  - twofactor_backupcodes: 1.0.0
  - updatenotification: 1.1.1
  - weather: 1.3.3
  - workflowengine: 1.1.1
Disabled:
  - encryption
  - external
  - fbsync
  - files_automatedtagging
  - files_retention
  - files_texteditor
  - mail
  - music
  - templateeditor
  - user_external
  - user_ldap
  - user_saml

The content of config/config.php:

{
    "system": {
        "instanceid": "oc5ly9kwuaz5",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "cloud.land-laeufer.de"
        ],
        "datadirectory": "\/var\/www\/vhosts\/land-laeufer.de\/cloud.land-laeufer.de\/data",
        "overwrite.cli.url": "https:\/\/cloud.land-laeufer.de",
        "dbtype": "mysql",
        "version": "11.0.0.5",
        "dbname": "nextcloud",
        "dbhost": "localhost",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "Europe\/Berlin",
        "installed": true,
        "maintenance": false,
        "filelocking.enabled": "true",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "file locking. enabled": "true",
        "redis": {
            "host": "localhost",
            "port": 6379
        },
        "loglevel": 3,
        "appstore.experimental.enabled": true,
        "updater.release.channel": "daily",
        "mail_domain": "land-laeufer.de",
        "mail_smtpmode": "php",
        "mail_from_address": "nextcloud",
        "theme": "",
        "integrity.check.disabled": true
    }
}

Are you using external storage, if yes which one: local/smb/sftp/... No Are you using encryption: yes/no. No

Client configuration

Browser: Chrome Browser Operating system: Ubuntu 16.04 CardDAV-clients: Davdroid Android

Logs

Web server error log

Insert your webserver log here

Nextcloud log (data/nextcloud.log)

Sabre\DAV\Exception\UnsupportedMediaType: HTTP/1.1 415 Validation error in vCard: REV MUST NOT appear more than once in a VCARD component

davdroid Android og

SYNCHRONIZATION INFO
Synchronization phase: 4
Account name: lars@land-laeufer.de
Authority: com.android.contacts

HTTP REQUEST:
PUT /remote.php/dav/addressbooks/users/lars/Kontakte%20Telefon/e3c28fd9-2291-45fa-a4ec-8fabfe7607af.vcf
If-Match: "51ee05ba3c014f132cb390cad2c41770"

BEGIN:VCARD[CR][LF]
VERSION:4.0[CR][LF]
PRODID:+//IDN bitfire.at//DAVdroid/1.3.4.1-gplay vcard4android ez-vcard/0.1[CR][LF]
 0.0[CR][LF]
REV;VALUE=timestamp:2016-11-20T12:16:49.095Z[CR][LF]
davdroid1.X-ABLabel:Internet[CR][LF]
davdroid2.X-ABLabel:PROFILE[CR][LF]
UID:e3c28fd9-2291-45fa-a4ec-8fabfe7607af[CR][LF]
FN:Anja Krah[CR][LF]
N:Krah;Anja;;;[CR][LF]
TEL;TYPE=cell:01732387670[CR][LF]
davdroid1.EMAIL;TYPE=x-internet:xxxxx@gmail.com[CR][LF]
davdroid2.URL;TYPE=X-PROFILE:http://www.google.com/xda /104183916085464[CR][LF]
 189577[CR][LF]
BDAY:19780705[CR][LF]
PHOTO:data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBw[CR][LF]
 [LF]
[some entry's more but removed]] 
 CiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA//9k=[CR][LF]
REV:20161202T045318Z[CR][LF]
END:VCARD[CR][LF]

HTTP RESPONSE:
h2 415 
cache-control: no-store, no-cache, must-revalidate
content-security-policy: default-src 'none';
content-type: application/xml; charset=utf-8
date: Fri, 02 Dec 2016 04:53:56 GMT
expires: Thu, 19 Nov 1981 08:52:00 GMT
ms-author-via: DAV
pragma: no-cache
server: nginx
set-cookie: nc_username=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; secure; HttpOnly
set-cookie: nc_token=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; secure; HttpOnly
set-cookie: nc_session_id=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; secure; HttpOnly
set-cookie: nc_username=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; secure; HttpOnly
set-cookie: nc_token=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; secure; HttpOnly
set-cookie: nc_session_id=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; secure; HttpOnly
set-cookie: oc5ly9kwuaz5=cpekvjtm3i27acahd4b2a4eqg1; path=/; secure; HttpOnly
x-content-type-options: nosniff
x-download-options: noopen
x-frame-options: SAMEORIGIN
x-permitted-cross-domain-policies: none
x-powered-by: PHP/7.0.13
x-powered-by: PleskLin
x-robots-tag: none
x-xss-protection: 1; mode=block

<?xml version="1.0" encoding="utf-8"?>[LF]
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">[LF]
  <s:exception>Sabre\DAV\Exception\UnsupportedMediaType</s:exception>[LF]
  <s:message>Validation error in vCard: REV MUST NOT appear more than once in a VCARD component</s:message>[LF]
</d:error>[LF]

EXCEPTION:
at.bitfire.dav4android.exception.HttpException: 415 
    at at.bitfire.dav4android.DavResource.checkStatus(DavResource.java:318)
    at at.bitfire.dav4android.DavResource.checkStatus(DavResource.java:291)
    at at.bitfire.dav4android.DavResource.put(DavResource.java:202)
    at at.bitfire.davdroid.syncadapter.SyncManager.uploadDirty(SyncManager.java:317)
    at at.bitfire.davdroid.syncadapter.SyncManager.performSync(SyncManager.java:147)
    at at.bitfire.davdroid.syncadapter.ContactsSyncAdapterService$ContactsSyncAdapter.sync(ContactsSyncAdapterService.java:64)
    at at.bitfire.davdroid.syncadapter.SyncAdapterService$SyncAdapter.onPerformSync(SyncAdapterService.java:85)
    at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java)

SOFTWARE INFORMATION
Package: at.bitfire.davdroid
Version: 1.3.4.1-gplay (129) Mon Nov 14 19:39:42 GMT+01:00 2016
Installed from: com.google.android.feedback
JB Workaround installed: no

CONFIGURATION
System-wide synchronization: automatically
Account: lars@land-laeufer.de
  Address book sync. interval: 240 min
  Calendar     sync. interval: 240 min
  OpenTasks    sync. interval: 240 min
  WiFi only: false
  [CardDAV] Contact group method: CATEGORIES
  [CalDAV] Time range (past days): 90
           Manage calendar colors: true

SQLITE DUMP
android_metadata
    |  locale |
    |  de_DE |
----------
settings
    |  setting | value |
----------
services
    |  _id | accountName | service | principal |
    |  5 | lars@domain.de | carddav | https://cloud.domain. de/remote.php/dav/principals/users/lars/ |
    |  6 | lars@domain.de | caldav | https://cloud.domain.de/remote.php/dav/principals/users/lars/ |
----------
sqlite_sequence
    |  name | seq |
    |  services | 6 |
    |  homesets | 9 |
    |  collections | 33 |
----------
homesets
    |  _id | serviceID | url |
    |  8 | 6 | https://cloud.domain.de/remote.php/dav/calendars/lars/ |
    |  9 | 5 | https://cloud.domain.de/remote.php/dav/addressbooks/users/lars/ |
----------
collections
    |  _id | serviceID | url | readOnly | displayName | description | color | timezone | supportsVEVENT | supportsVTODO | sync |
    |  26 | 6 | https://://cloud.domain.de/remote.php/dav/calendars/lars/contact_birthdays/ | 1 | Geburtstage von Kontakten | <null> | -54 | <null> | 1 | 0 | 0 |
    |  27 | 6 | https://cloud.domain.de/remote.php/dav/calendars/lars/ist-stunden-arbeit/ | 0 | Ist-stunden Arbeit | <null> | -9115694 | <null> | 1 | 1 | 1 |
    |  28 | 6 | https://cloud.domain.de/remote.php/dav/calendars/lars/muell/ | 0 | Muell | <null> | -9139225 | <null> | 1 | 1 | 1 |
    |  29 | 6 | https://cloud.domain.de/remote.php/dav/calendars/lars/veranstaltungen/ | 0 | Veranstaltungen | <null> | -9122585 | <null> | 1 | 1 | 1 |
    |  30 | 6 | https://cloud.domain.de/remote.php/dav/calendars/lars/arbeit/ | 0 | Arbeit | <null> | -1605516 | <null> | 1 | 1 | 1 |
    |  31 | 6 | https://cloud.domain.de/remote.php/dav/calendars/lars/priavtes/ | 0 | Privates | <null> | -8853644 | <null> | 1 | 1 | 1 |
    |  32 | 6 | https://cloud.domain.de/remote.php/dav/calendars/lars/arbeit-anja/ | 0 | Arbeit anja | <null> | -9139225 | <null> | 1 | 1 | 1 |
    |  33 | 5 | https://cloud.cloud.domain.de/remote.php/dav/addressbooks/users/lars/Kontakte%20Telefon/ | 0 | Kontakte Telefon | <null> | <null> | <null> | <null> | <null> | 1 |
----------

SYSTEM INFORMATION
Android version: 6.0.1 (23.5.A.1.291)
Device: Sony D6603 (D6603)
Happyfeet01 commented 7 years ago

The issue starts after adding profile picture to some of my contacts.

hoellen commented 7 years ago

Same here since update to NC 11: 415 unsupported Media Type

rfc2822 commented 7 years ago

See #41

guddl commented 7 years ago

Same here since update to NC 11: 415 unsupported Media Type

This happens when I modify a contact on my Android phone.

To get rid of the error, I exported the contact from the Nexcloud contacts app. Then I deleted it on both sides. After that, it syncs correctly. When I import the contact again in the Nextcloud contacts app the syncs works fine - and the contact is added to my Android phone

simonspa commented 7 years ago

As pointed out by @rfc2822 the issue is not the media type but the revision tag. Reading your quoted error log, it says:

Validation error in vCard: REV MUST NOT appear more than once in a VCARD component

which should be solved via #65. Also, the developer of ez-vcard used by DAVdroid added support for the milliseconds of the timestamp: https://github.com/mangstadt/ez-vcard/issues/73 So this should be fixed in the upcoming version of DAVdroid from the client side.

Suggesting to close ticket.

albinou commented 7 years ago

You are right. I had the same "unsupported Media Type" issue and it has been solved by the last DAVdroid official release (1.3.6-ose available on f-droid).

enoch85 commented 7 years ago

This still appears for me when syncing with Thunderbird (on each run):

Fatal   webdav  Sabre\DAV\Exception\UnsupportedMediaType: HTTP/1.1 415 Validation error in vCard: The FN property must appear in the VCARD component exactly 1 time
/var/www/nextcloud/3rdparty/sabre/dav/lib/CardDAV/Plugin.php - line 316: Sabre\CardDAV\Plugin->validateVCard('BEGIN VCARD\r\nVE...', false)
[internal function] Sabre\CardDAV\Plugin->beforeCreateFile('addressbooks/us...', 'BEGIN VCARD\r\nVE...', Object(OCA\DAV\CardDAV\AddressBook), false)
/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1070: Sabre\Event\EventEmitter->emit('beforeCreateFil...', Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 525: Sabre\DAV\Server->createFile('addressbooks/us...', 'BEGIN VCARD\r\nVE...', NULL)
[internal function] Sabre\DAV\CorePlugin->httpPut(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method PUT', Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/apps/dav/lib/Server.php - line 231: Sabre\DAV\Server->exec()
/var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 31: OCA\DAV\Server->exec()
/var/www/nextcloud/remote.php - line 165: require_once('/var/www/nextcl...')
{main}
2017-05-03T20:57:42+0200
Fatal   webdav  Sabre\DAV\Exception\UnsupportedMediaType: HTTP/1.1 415 Validation error in vCard: The FN property must appear in the VCARD component exactly 1 time
/var/www/nextcloud/3rdparty/sabre/dav/lib/CardDAV/Plugin.php - line 316: Sabre\CardDAV\Plugin->validateVCard('BEGIN VCARD\r\nVE...', false)
[internal function] Sabre\CardDAV\Plugin->beforeCreateFile('addressbooks/us...', 'BEGIN VCARD\r\nVE...', Object(OCA\DAV\CardDAV\AddressBook), false)
/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1070: Sabre\Event\EventEmitter->emit('beforeCreateFil...', Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 525: Sabre\DAV\Server->createFile('addressbooks/us...', 'BEGIN VCARD\r\nVE...', NULL)
[internal function] Sabre\DAV\CorePlugin->httpPut(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method PUT', Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/apps/dav/lib/Server.php - line 231: Sabre\DAV\Server->exec()
/var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 31: OCA\DAV\Server->exec()
/var/www/nextcloud/remote.php - line 165: require_once('/var/www/nextcl...')
{main}
2017-05-03T20:57:41+0200
Fatal   webdav  Sabre\DAV\Exception\UnsupportedMediaType: HTTP/1.1 415 Validation error in vCard: The FN property must appear in the VCARD component exactly 1 time
/var/www/nextcloud/3rdparty/sabre/dav/lib/CardDAV/Plugin.php - line 316: Sabre\CardDAV\Plugin->validateVCard('BEGIN VCARD\r\nVE...', false)
[internal function] Sabre\CardDAV\Plugin->beforeCreateFile('addressbooks/us...', 'BEGIN VCARD\r\nVE...', Object(OCA\DAV\CardDAV\AddressBook), false)
/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1070: Sabre\Event\EventEmitter->emit('beforeCreateFil...', Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 525: Sabre\DAV\Server->createFile('addressbooks/us...', 'BEGIN VCARD\r\nVE...', NULL)
[internal function] Sabre\DAV\CorePlugin->httpPut(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method PUT', Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/apps/dav/lib/Server.php - line 231: Sabre\DAV\Server->exec()
/var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 31: OCA\DAV\Server->exec()
/var/www/nextcloud/remote.php - line 165: require_once('/var/www/nextcl...')
{main}
2017-05-03T20:57:41+0200

Using Lightning and Sogo connector like described in the documentation: https://docs.nextcloud.com/server/11/user_manual/pim/sync_thunderbird.html

I'm on Nextcloud 11.0.3 with Ubuntu 16.04, Apache 2.4 and PHP 7. My Desktop is Ubuntu Budgie 17.04 (great OS btw)

And I'm using Davdroid 1.5.1, so not solved there if it's related to that.

simonspa commented 7 years ago

Suggesting to open a new ticket for this. Reasons:

enoch85 commented 7 years ago

@simonspa https://github.com/nextcloud/contacts/issues/206

bestouff commented 6 years ago

I still have the problem with DAVDroid 1.11.1-ose from f-droid : Validation error in vCard: REV MUST NOT appear more than once in a VCARD component