ranguard / text-vcard

Perl package to edit and create vCard(s) (RFC 2426)
22 stars 15 forks source link

Error processing Gmail's contacts.vcf #57

Open jmgk77 opened 5 years ago

jmgk77 commented 5 years ago

hi, i recently started to get this error while processing gmail contacts exported in vcf format:

Can't call method "family" on an undefined value at /usr/local/share/perl/5.26.1/vCard/AddressBook.pm line 208.

this code used to work for years, without problems. I believe something changed on google's side.

gregoa commented 4 years ago

That's not only happening with GMail but with any vCard which lacks specific attributes, in this case the "N:" value. Cf. https://bugs.debian.org/958194

I guess the _copy_name sub should check for the existence / should check the result of ->get('n') like the other _copy_FOO subs do.

ranguard commented 4 years ago

I try to merge PR's with tests (but don't always have time) and do releases after that :)

If anyone is open to doing a PR that is

robscovell-ts commented 4 years ago

Here is an example (not a real person): BEGIN:VCARD VERSION:3.0 FN:Curtis Lopez N:Lopez;Curtis;;; EMAIL;TYPE=INTERNET:curtisllopez@yahoo.com TEL;TYPE=CELL:(406) 869-1855 ADR;TYPE=HOME:;;4685 Coolidge Street;Billings;MT;59101;United States of America;4 685 Coolidge Street\nBillings\nMT\n59101\nUnited States of America NOTE:Works as a nursing assistant\,\nINITIALS: C.L. CATEGORIES:Newsletter,myContacts END:VCARD

After the Country value there is an optional 8th value ('LABEL') containing a formatted version of the complete address.