owncloud / contacts

:busts_in_silhouette: Manage your CardDAV contacts from a feature-rich web-interface
75 stars 46 forks source link

Include better error reporting on contact import #655

Open 0xE0-rng opened 5 years ago

0xE0-rng commented 5 years ago

The current import works well, but for the cases when it fails it does not report any errors as the error does not get set properly. It would be nice to have some the contact it fails on printed out (even to the console would be helpful)

let vData = ICAL.stringify(contact.vCard.jCal)
// push contact to server and use limit
requests.push(limit(() => contact.addressbook.dav.createVCard(vData)
    .then((response) => {
        // setting the contact dav property
        Vue.set(contact, 'dav', response)

        // success, update store
        context.commit('addContact', contact)
        context.commit('addContactToAddressbook', contact)
        context.commit('extractGroupsFromContacts', [contact])
        context.commit('incrementAccepted')
    })
    .catch((error) => {
        // error is not set properly
        context.commit('incrementDenied')
        console.error(error)
    })
))

Steps to reproduce

  1. Open Import
  2. select contacts with maleformed content
  3. no error

Problems that I happens with importing contacts that contain special characters like emojis, contacts that do not contain characters as names, contatct that dont have a name set

The following contacts are example contacts that will produce an error

BEGIN:VCARD
VERSION:3.0
FN:Peter 🇨🇵
N:🇨?;Peter;;;
TEL;TYPE=CELL:+123123123
BDAY;VALUE=DATE:19960101
UID:36426aa9-7290-4e06-af17-ac50655cf7f0
END:VCARD
BEGIN:VCARD
VERSION:3.0
TEL;TYPE=CELL:+123123123
ITEM1.ORG:AEM (jm)
ITEM1.X-ABLABEL:
UID:0cff052e-a800-4719-9df3-203e0a608602
END:VCARD
BEGIN:VCARD
VERSION:3.0
TEL;TYPE=CELL:+123123123
UID:e9f1a5d3-871b-4cf1-8874-6d2edce24d9d
END:VCARD

Expected behaviour

A error message is shown that includes the contact the import had problems with.

Actual behaviour

Non informational errors like the following are reported

Error
    at XMLHttpRequest.s.onreadystatechange (http://192.168.178.35/apps/contacts/js/contacts.js?v=0694d79e-0:7:213118)

Server configuration

Operating system: FreeNas

Web server: nginx

Database: mysql Version: 5.6.42

PHP version: 7.1.25

ownCloud version: 15.0.0

Contacts version: 1.6.4

Updated from an older ownCloud or fresh install: fresh install from freeNas plugin