nextcloud / contacts

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

Show more details about the failing reason of an import #990

Open Leon5x opened 5 years ago

Leon5x commented 5 years ago

When importing a vcf file exported by the google calendar app on android the contacts app opens the import windows, and closes it again immediately afterwards. Nothing was imported, no error messages given.

I guess the exported vcf file is in an invalid format, but even if I change it to a (I guess) valid format it fails silently on version 2.1. I would expect a message that this vcf version is not supported or that there is something wrong with the vcf format. In the best case also help for what to do.

To Reproduce Import the vcard (invalid format):

BEGIN:VCARD
VERSION:2.1
N:;aatest;;;
FN:aatest
TEL;CELL:1
END:VCARD

or the vcard (with valid format):

BEGIN:VCARD
VERSION:2.1
N:;aatest;;;
FN:aatest
TEL;type=CELL:1
END:VCARD

When changing the version in the last vcard to 3.0 it imports properly.

Expected behavior The contacts app should display an error message that the vcard couldn't be imported and state the reason for that (Invalid format or old vcard version).

Actual behavior The importing dialog opens and closes immediately afterwards, nothing can be seen there.

Server configuration

Operating system: Linux

Web server: Apache

Database: MariaDB

PHP version: 7.2

Nextcloud version: 15.0.5

Contacts version: 3.0.5

Updated from an older Nextcloud or fresh install: Updated from an older nc instance

Signing status:

No errors have been found.

List of activated apps:

Enabled:
  - accessibility: 1.1.0
  - activity: 2.8.2
  - calendar: 1.6.4
  - cloud_federation_api: 0.1.0
  - comments: 1.5.0
  - contacts: 3.0.5
  - dav: 1.8.1
  - federatedfilesharing: 1.5.0
  - federation: 1.5.0
  - files: 1.10.0
  - files_external: 1.6.0
  - files_pdfviewer: 1.4.0
  - files_sharing: 1.7.0
  - files_texteditor: 2.7.0
  - files_trashbin: 1.5.0
  - files_versions: 1.8.0
  - files_videoplayer: 1.4.0
  - firstrunwizard: 2.4.0
  - gallery: 18.2.0
  - logreader: 2.0.0
  - lookup_server_connector: 1.3.0
  - nextcloud_announcements: 1.4.0
  - notes: 2.5.1
  - notifications: 2.3.0
  - oauth2: 1.3.0
  - password_policy: 1.5.0
  - polls: 0.10.1
  - provisioning_api: 1.5.0
  - serverinfo: 1.5.0
  - sharebymail: 1.5.0
  - support: 1.0.0
  - survey_client: 1.3.0
  - systemtags: 1.5.0
  - tasks: 0.9.8
  - theming: 1.6.0
  - twofactor_backupcodes: 1.4.1
  - updatenotification: 1.5.0
  - workflowengine: 1.5.0
Disabled:
  - admin_audit
  - audioplayer
  - bruteforcesettings
  - encryption
  - files_opds
  - spreed
  - user_ldap

Nextcloud configuration:

{
    "system": {
        "memcache.local": "\\OC\\Memcache\\APCu",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "15.0.5.3",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "maintenance": false,
        "loglevel": 2,
        "enabledPreviewProviders": [
            "OC\\Preview\\Image",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\Epub",
            "OC\\Preview\\PDF"
        ],
        "theme": "",
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "updater.release.channel": "stable"
    }
}

Client configuration

Browser: Googel Chrome 72.0.3626.121

Operating system: Windows 10

CardDAV-clients: DAVDroid

Logs

Web server error log

nothing related

Nextcloud log

data/nextcloud.log

{"reqId":"id","level":4,"time":"2019-03-11T20:16:57+00:00","remoteAddr":"","user":"user","app":"webdav","method":"PUT","url":"\/nextcloud\/remote.php\/dav\/addressbooks\/users\/user\/contacts\/D37730C8-09FC-4CAF-A56C-79E45D583894.vcf","message":{"Exception":"Sabre\\DAV\\Exception\\UnsupportedMediaType","Message":"Validation error in vCard: CardDAV servers are not allowed to accept vCard 2.1.","Code":0,"Trace":[{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/CardDAV\/Plugin.php","line":316,"function":"validateVCard","class":"Sabre\\CardDAV\\Plugin","type":"->","args":["BEGIN:VCARD\r\nVERSION:2.1\r\nN:;aatest;;;\r\nFN:aatest\r\nTEL;TYPE=CELL:1\r\nUID:06794743-1652-4fe5-9db3-2a38f15d797d\r\nREV:20190311T201657Z\r\nEND:VCARD\r\n",false]},{"function":"beforeCreateFile","class":"Sabre\\CardDAV\\Plugin","type":"->","args":["addressbooks\/users\/user\/contacts\/D37730C8-09FC-4CAF-A56C-79E45D583894.vcf","BEGIN:VCARD\r\nVERSION:2.1\r\nN:;aatest;;;\r\nFN:aatest\r\nTEL;TYPE=CELL:1\r\nUID:06794743-1652-4fe5-9db3-2a38f15d797d\r\nREV:20190311T201657Z\r\nEND:VCARD\r\n",{"__class__":"OCA\\DAV\\CardDAV\\AddressBook"},false]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"directories":[],"__class__":"OCA\\DAV\\CardDAV\\Plugin"},"beforeCreateFile"],["addressbooks\/users\/user\/contacts\/D37730C8-09FC-4CAF-A56C-79E45D583894.vcf","BEGIN:VCARD\r\nVERSION:2.1\r\nN:;aatest;;;\r\nFN:aatest\r\nTEL;TYPE=CELL:1\r\nUID:06794743-1652-4fe5-9db3-2a38f15d797d\r\nREV:20190311T201657Z\r\nEND:VCARD\r\n",{"__class__":"OCA\\DAV\\CardDAV\\AddressBook"},false]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":1094,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["beforeCreateFile",["addressbooks\/users\/user\/contacts\/D37730C8-09FC-4CAF-A56C-79E45D583894.vcf","BEGIN:VCARD\r\nVERSION:2.1\r\nN:;aatest;;;\r\nFN:aatest\r\nTEL;TYPE=CELL:1\r\nUID:06794743-1652-4fe5-9db3-2a38f15d797d\r\nREV:20190311T201657Z\r\nEND:VCARD\r\n",{"__class__":"OCA\\DAV\\CardDAV\\AddressBook"},false]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":525,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["addressbooks\/users\/user\/contacts\/D37730C8-09FC-4CAF-A56C-79E45D583894.vcf","BEGIN:VCARD\r\nVERSION:2.1\r\nN:;aatest;;;\r\nFN:aatest\r\nTEL;TYPE=CELL:1\r\nUID:06794743-1652-4fe5-9db3-2a38f15d797d\r\nREV:20190311T201657Z\r\nEND:VCARD\r\n",null]},{"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https:\/\/lwtw.ddnss.de\/nextcloud\/remote.php\/dav\/addressbooks\/users\/user\/contacts\/D37730C8-09FC-4CAF-A56C-79E45D583894.vcf","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpPut"],[{"absoluteUrl":"https:\/\/lwtw.ddnss.de\/nextcloud\/remote.php\/dav\/addressbooks\/users\/user\/contacts\/D37730C8-09FC-4CAF-A56C-79E45D583894.vcf","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:PUT",[{"absoluteUrl":"https:\/\/lwtw.ddnss.de\/nextcloud\/remote.php\/dav\/addressbooks\/users\/user\/contacts\/D37730C8-09FC-4CAF-A56C-79E45D583894.vcf","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https:\/\/lwtw.ddnss.de\/nextcloud\/remote.php\/dav\/addressbooks\/users\/user\/contacts\/D37730C8-09FC-4CAF-A56C-79E45D583894.vcf","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/nextcloud\/apps\/dav\/lib\/Server.php","line":301,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/apps\/dav\/appinfo\/v2\/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/nextcloud\/remote.php","line":163,"args":["\/var\/www\/nextcloud\/apps\/dav\/appinfo\/v2\/remote.php"],"function":"require_once"}],"File":"\/var\/www\/nextcloud\/3rdparty\/sabre\/dav\/lib\/CardDAV\/Plugin.php","Line":397,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/72.0.3626.121 Safari\/537.36","version":"15.0.5.3"}

Browser log

For the vcard with a valid format and a wrong version

PUT https://*/nextcloud/remote.php/dav/addressbooks/users/*/contacts/20895E5E-D8FA-4800-B81B-A0B120129501.vcf 415 (Unsupported Media Type)
Error
    at XMLHttpRequest.s.onreadystatechange (dist.js:1)

For the vcard with a invalid format and a wrong version

parseVcf.js:47
r {message: "Invalid parameters in 'TEL;CELL:1'", name: "ParserError", stack: "    at new r (https://*/nextcloud/apps…apps/contacts/js/contacts.js?v=728b7e97-5:91:5652"}
message: "Invalid parameters in 'TEL;CELL:1'"
name: "ParserError"
stack: "    at new r (https://*/nextcloud/apps/contacts/js/contacts.js?v=728b7e97-5:7:79789)↵    at Function.i._handleContentLine (https://*/nextcloud/apps/contacts/js/contacts.js?v=728b7e97-5:7:80550)↵    at https://*/nextcloud/apps/contacts/js/contacts.js?v=728b7e97-5:7:79967↵    at Function.i._eachLine (https://*/nextcloud/apps/contacts/js/contacts.js?v=728b7e97-5:7:83496)↵    at Object.i [as parse] (https://*/nextcloud/apps/contacts/js/contacts.js?v=728b7e97-5:7:79939)↵    at new t (https://*/nextcloud/apps/contacts/js/contacts.js?v=728b7e97-5:156:300)↵    at https://*/nextcloud/apps/contacts/js/contacts.js?v=728b7e97-5:69:241↵    at Array.reduce (<anonymous>)↵    at sn (https://*/nextcloud/apps/contacts/js/contacts.js?v=728b7e97-5:69:210)↵    at https://*/nextcloud/apps/contacts/js/contacts.js?v=728b7e97-5:91:5652"
__proto__: Object
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/71253447-show-more-details-about-the-failing-reason-of-an-import?utm_campaign=plugin&utm_content=tracker%2F46751899&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F46751899&utm_medium=issues&utm_source=github).
nextcloud-bot commented 5 years ago

GitMate.io thinks possibly related issues are https://github.com/nextcloud/contacts/issues/236 (.vcf import fails silently), https://github.com/nextcloud/contacts/issues/678 (Importing fixes), https://github.com/nextcloud/contacts/issues/343 (Issues after import), https://github.com/nextcloud/contacts/issues/574 (Import of vcf file causes lots of errors), and https://github.com/nextcloud/contacts/issues/389 (Import of Outlook VCARD failing).

skjnldsv commented 5 years ago

Yes, this is a plan feature :) To have a detailed list of contacts who failed and why. You imported a single vcard, right?

The main issue is how to manage the display when you have 100 contacts that failed on import, we don't want to flood the Interface with data :thinking:

How would you like having this info? :thinking:

Leon5x commented 5 years ago

Good to know :)

Actually I wanted to import over hundreds of vcards, to import the contacts from my phone. The single vcard I attached was just minimal a test I created to try to find where the error lies. I just found out that all the contacts in my file are in an invalid format. So it is definitely my mistake, sorry.

As a quick bugfix I would recommend adding an ok button to the importing dialog, so it doesn't close automatically. So you can at least see that there is something wrong with the file you wanted to import and not expect the import function to be broken at the moment.

The info would be nice to have just under the importing dialog after it is finished. You don't need to display all the errors, just make an expandable box which is just one line and you can expand it to view the details of the errors. Does this make sense?

skjnldsv commented 5 years ago

As a quick bugfix I would recommend adding an ok button to the importing dialog, so it doesn't close automatically.

Awesome! This is also planned here: #606 :tada:

The info would be nice to have just under the importing dialog after it is finished. You don't need to display all the errors, just make an expandable box which is just one line and you can expand it to view the details of the errors. Does this make sense?

Totally does! Let's make this issue about this! :)

jancborchardt commented 5 years ago

The main issue is how to manage the display when you have 100 contacts that failed on import, we don't want to flood the Interface with data thinking

I just did an import of contacts, and it’s not that many, around ~200. But ~50 of them failed. Now that I closed the import window there’s no way I can know which ones of them failed, and they are not displayed.

I’d say that "failed" import, for whatever reason, should not lead to the contacts not displaying at all. Some of it has to be salvageable, like the name or some fields, no? It would be way better to show entries for all the contacts so you at least have some indication, but with an "Error" icon of some sort so you can fix it.

skjnldsv commented 5 years ago

Some of it has to be salvageable, like the name or some fields, no? It would be way better to show entries for all the contacts so you at least have some indication, but with an "Error" icon of some sort so you can fix it.

depends on the errors. We fix the one we can, otherwise it's either, not implemented by the library, or not fixeable by us :)

Do you have more input on the errors Jan? You can have all the details on the console logs

graphixillusion commented 5 years ago

I just tried to import a vcf v3 file into the contact app. The import process is good but after that i can't add new contacts from the web ui even if i create new AddressBook. It always show the error "unable to create contact". In the developer console i get this error: TypeError: e.value.toUnixTime is not a function Any way to fix this? Thank you!

skjnldsv commented 5 years ago

@graphixillusion please create a new issue and fill the appropriate template :)

iptizer commented 4 years ago

Found this Issue while having trouble to import Contacts exported from my Android into Nextcloud.

Problem: Nextcloud seems to only support vcf 3.0, Android exports vcf 2.1.

Solution: Using this project I was able to convert all my contacts to 3.0. After that the import ran through with 0 errors on 385 contacts.

jancborchardt commented 4 years ago

@iptizer good find – could you open a separate issue about the vcf version compatibility issue? Thanks! :)

skjnldsv commented 4 years ago

@iptizer good find – could you open a separate issue about the vcf version compatibility issue? Thanks! :)

Please don't, we do not support vcard 2.1, and there is already an opened issue https://github.com/nextcloud/contacts/issues/492 ;)

Matthias84 commented 4 years ago

From a user perspective, it would be pretty cool, if all the importers of NC could adapt to a similar (more descriptive) UI pattern: https://github.com/nextcloud/calendar/issues/2065 So for example giving numbers on dublicates, format issues, ... and details of which objects failed (e.g. in a more button which expands to a log listing)

rubo77 commented 4 years ago

Maybe we can add a solution to the warning:

If someone tries to import a 2.1 vcard, there could be a warning like this:

"You tried to import a vCard in the old v2.1 format. please convert it to v3.0. e.g. with this conversion script: https://github.com/jowave/vcard2to3 or online with https://labs.brotherli.ch/vcfconvert/"

xeruf commented 2 years ago

I had a similar issue, where it reported "2 errors" - I had to look into the logs as admin to find out that it was a wrongly formatted field and thus two birthdays would have gone missing :/

Mte90 commented 1 year ago

I got this https://github.com/nextcloud/contacts/issues/492 and only with a search online I found those tickets. Add some information about the errors in importing is very important otherwise is very uselesss the import feature.