Giter Club home page Giter Club logo

node-vcard's Issues

Version Validation Returning False Negative

Version validation with the following text says that there is no version.

BEGIN:VCARD
VERSION:2.1
TEL;CHARSET=utf-8;WORK;VOICE:(212) 9928540
TEL;CHARSET=utf-8;CELL;VOICE:(646) 7727032
EMAIL;CHARSET=utf-8:[email protected]
LABEL;CHARSET=utf-8;WORK:Palladium Athletic Facility 140 East 14th Street New York, NY 10003
ADR;CHARSET=utf-8;WORK:;;Palladium Athletic Facility 140 East 14th Street;New York;NY;10003;
N;CHARSET=utf-8:Lefevre;Noah;D.;;
FN;CHARSET=utf-8:Noah D. Lefevre
ORG;CHARSET=utf-8:NYU
TITLE;CHARSET=utf-8:Associate Director of Athletics
NOTE;ENCODING=QUOTED-PRINTABLE;CHARSET=utf-8:NYU=0D=0A=
ATHLKTIC8=0D=0A=
Noah D. LeFevre=0D=0A=
Associate Director of Athletics=0D=0A=
Palladium Athletic Facility=0D=0A=
140 East 14th Street=0D=0A=
New York, NY 10003=0D=0A=
Office: (212) 992-8540=0D=0A=
Cell: (646) 772-7032=0D=0A=
Email: [email protected]
REV:09072016142221
END:VCARD

vCards are printed to console

I found a leftover console.info call to print the vcards, it's on line 77 of file vcard.js, could you please remove it? Seems like leftover debugging logic...

If you are willing to accept, a pull request can be made to fix this.

Single output value for multiple input values of same type

Multiple values for a field seem to be ignored, e.g.: The following .vcf (taken from this projects samples)

BEGIN:VCARD
VERSION:2.1
X-FOO:FOO
N:Gump;Forrest
FN:Forrest Gump
ORG:Bubba Gump Shrimp Co.
TITLE:Shrimp Man
TEL;WORK;VOICE:(111) 555-1212
TEL;HOME;VOICE:(404) 555-1212
ADR;WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:100 Waters Edge=0D=0ABaytown, LA 30314=0D=0AUnited States of America
ADR;HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
LABEL;HOME;ENCODING=QUOTED-PRINTABLE:42 Plantation St.=0D=0ABaytown, LA 30314=0D=0AUnited States of America
EMAIL;PREF;INTERNET:[email protected]
REV:20080424T195243Z
END:VCARD

produces the following result:

{ REV: '20080424T195243Z',
  TITLE: 'Shrimp Man',
  FN: 'Forrest Gump',
  'X-FOO': 'FOO',
  VERSION: '2.1',
  EMAIL:
   { type: [ 'INTERNET', 'PREF' ],
     value: '[email protected]' },
  LABEL:
   { type: [ 'ENCODING=QUOTED-PRINTABLE', 'WORK' ],
     value: '100 Waters Edge=0D=0ABaytown, LA 30314=0D=0AUnited States of Americ
a' },
  ADR:
   { type: [ 'WORK' ],
     value: ';;100 Waters Edge;Baytown;LA;30314;United States of America' },
  TEL: { type: [ 'VOICE', 'WORK' ], value: '(111) 555-1212' },
  ORG: 'Bubba Gump Shrimp Co.',
  N: 'Gump, Forrest' }

Expected for key TEL to see an array holding multiple entries:

TEL;WORK;VOICE:(111) 555-1212
TEL;HOME;VOICE:(404) 555-1212

Escaped colons are improperly parsed

Google gives back a URL like so:

'URL:https\\://plus.google.com/u/0/38497128973128932',

The colon has been escaped with a double backslash. Once it has been parsed, the output is simply:

https\

This means that the colon was not escaped at all.

If you are willing to accept, a pull request can be made to fix this.

Fixed a bug for you

My vards have ';' instead of ':'

I am getting adressbook from iphone...

it is a little sloppy for me to find and replace all ';' with ':' in my vcard data.
Plus it could add a bug because the logic is not 100% correct...

can you please update your regexp to support ';' as well as ':'

I did this quick fix:

Inside the vcard.js

line 261
changed
if (data[f].match(/^(VERSION|FN):/)) {
to
if (data[f].match(/^(VERSION|FN)/)) {

line 275
changed
if (data[f].match(/^N:/)) {
to
if (data[f].match(/^N/)) {


Thanks buddy.

quoted-printable not handled correctly

My Source data (from sipgate.de API, extended by VERSION:2.1\r\n):

BEGIN:VCARD\r\nVERSION:2.1\r\nFN;quoted-printable:Peter Pan\r\nNOTE;quoted-printable:\r\nTEL;cell:+49123123123123\r\nEND:VCARD

This is always treated as invalid data because the validator cannot find a FN entry. But it's present with a semicolon and quoted-printable which is valid I think (as of http://www.imc.org/pdi/vcard-21.txt).

Vendor specific tags cause parsing failure

It looks like Vendor specific tags as described in the RFC are not handled.

From https://datatracker.ietf.org/doc/html/rfc6350:

vCard elements belonging to the vendor namespace will be
distinguished by the "VND-" prefix. This is followed by an IANA-
registered Private Enterprise Number (PEN), a dash, and a vCard
element designation of the vendor's choosing (e.g., "VND-123456-
MUDPIE").

The defect looks like it's in this.getValidationError() where it checks for valid tags using:

			if (!(u.contains(validFields.singleText, field) ||
			      u.contains(validFields.multipleText, field) ||
			      u.contains(validFields.rfc2425, field) ||
			      u.contains(validFields.singleBinary, field) ||
			      u.contains(validFields.structured, field) ||
			      field.match(/^X-.*/))){

That code needs an additional check as in:

			if (!(u.contains(validFields.singleText, field) ||
			      u.contains(validFields.multipleText, field) ||
			      u.contains(validFields.rfc2425, field) ||
			      u.contains(validFields.singleBinary, field) ||
			      u.contains(validFields.structured, field) ||
			      field.match(/^VND-.*/) ||
			      field.match(/^X-.*/))){

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.