nextcloud / contacts

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

Contacts saving errors out (PUT 415) (for vcards v.2.1) #1125

Closed newhinton closed 5 years ago

newhinton commented 5 years ago

Describe the bug

I wanted to sort all my ~200 contacts and make use of groups. I started sorting them. At first everything seems fine, the groups are beeing created and contacts moved, however, a reload reveals that only most of the contacts are beeing transferred. Some error out, but it is only visible on the console. The error does not contain great information about the error itself.

  1. Open Contact
  2. Add Group
  3. Continue working on contacts
  4. Reload and see that some have not been saved.

This behaviour is not limited by groups, basically any field is "readonly" and changes are not saved in the backend.

` Error: "" r https://domain.tld/apps/contacts/js/contacts.js?v=d261a300-80:512 r https://domain.tld/apps/contacts/js/contacts.js?v=d261a300-80:512 e https://domain.tld/apps/contacts/js/contacts.js?v=d261a300-80:512 e https://domain.tld/apps/contacts/js/contacts.js?v=d261a300-80:512 e https://domain.tld/apps/contacts/js/contacts.js?v=d261a300-80:512 onreadystatechange https://domain.tld/apps/contacts/js/contacts.js?v=d261a300-80:512 contacts.js:637:4631

`

Used browser: Firefox Nextcloud 16.0.1 Contacts 3.1.1

If you need a "broken" contact, i can provide some.

skjnldsv commented 5 years ago

Hey :) I will need a better log :/

If any error happens on contacts, we write detailed messages in the console.

newhinton commented 5 years ago

That is basically everything i get out of it which is clearly related to the saving.

Interestingly: For every contact that does work, and only those, i get the following:

The following contact needed a correction that failed: duplicate types [Object]

I will try to copy over my whole contacts database to my dev instance, but that will have to wait until tomorrow :D (Either i will be able to send you better logs, or better: i fix it :D )

newhinton commented 5 years ago

So, i got it set up and those are my results:

I have exported all my contacts from my production database, and there were no errors. My dump includes the broken contacts.

If i try to import this single file containing all ~300 contacts, i loose 126.

The error is still the same, Error: "" n dist.js:2878 e dist.js:2928 e dist.js:3066 e dist.js:3158 onreadystatechange dist.js:3688 addressbooks.js:598

It affects ALL version 2.1 vcards (107), and some 3.0 (9) and even less 4.0 (8)

I also found out, that the vcards that i cant import, are not the same which i cannot edit

newhinton commented 5 years ago

This is all very strange, and i don't quiet know what to do with the information i found :D

newhinton commented 5 years ago

It seems the import issue may be related to #990

newhinton commented 5 years ago

If i reeimport the corresponding vcard (download, delete & import) the vcard works fine (on prod) On my dev machine, i have no errors whatsoverer (except the import stuff, but i guess we can rule that out as the cause for my problems)

skjnldsv commented 5 years ago

It affects ALL version 2.1 vcards (107)

Make sense sinc we don't support vcard 2.1

skjnldsv commented 5 years ago

Could you check the network tab and see the output of the failed uploads? (not the 2.1 as we already know what's up)

newhinton commented 5 years ago

Okay. it seems that 2.1 is the issue. I get an 415 if i try to save the contact:

Request URL:https://domain.tld/remote.php/dav/addressbooks/users/Felix/Contacts/71b0bed1-7927-4722-8e4d-f35bf5aad541.vcf Request method:PUT Remote address:ip:443 Status code: 415 Version:HTTP/2.0 Referrer Policy:no-referrer-when-downgrade

The payload confirms that it is indeed a v 2.1 (have tested this for a few contacts)

So, now i know why it happens, but what should we do about it?

skjnldsv commented 5 years ago

You need to manually convert your vcard 2.1 to 3.0. This plugin seems to be made for that, never tried it though https://github.com/jowave/vcard2to3

newhinton commented 5 years ago

While that should solve my immediate problem, that could occur to other people as well. Is there a way this app could do such things automatically in the future? Or would that be work that is simply out of scope?

skjnldsv commented 5 years ago

Then : duplicate of https://github.com/nextcloud/contacts/issues/273 or https://github.com/nextcloud/contacts/issues/492 ;)

newhinton commented 5 years ago

that is what i thought! ;)

therefore: case closed!

thanks for pointing out 2.1 incompatibility, that made clear what was happening :)

skjnldsv commented 5 years ago

Also relevant https://github.com/nextcloud/contacts/issues/990