nextcloud / nextcloud/contacts
Show more details about the failing reason of an import
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 642
- Forks
- 220
- Avg merge
- 14h 39m
- Merged PRs (30d)
- 51
Description
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! We accept bounties via Bountysource.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the import flow around parseVcf.js:47 and the contacts.js code shown in the browser stack traces, then inspect how the PUT response from the DAV endpoint is handled. Reproduce both vCard examples and preserve the parser error and 415 response reason in a visible import error; done means the dialog no longer closes silently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100