text-vcard icon indicating copy to clipboard operation
text-vcard copied to clipboard

Error processing Gmail's contacts.vcf

Open jmgk77 opened this issue 6 years ago • 3 comments

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.

jmgk77 avatar Feb 07 '19 18:02 jmgk77

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.

gregoa avatar Apr 19 '20 15:04 gregoa

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

ranguard avatar Apr 19 '20 16:04 ranguard

Here is an example (not a real person): BEGIN:VCARD VERSION:3.0 FN:Curtis Lopez N:Lopez;Curtis;;; EMAIL;TYPE=INTERNET:[email protected] 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.

robscovell-ts avatar Jun 05 '20 23:06 robscovell-ts