Project

General

Profile

Actions

Bug #22

closed

Structural vCard VERSION bug in VCF lib

Added by Jörg Ebeling over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
10/22/2020
Due date:
% Done:

100%

Estimated time:
4:00 h

Description

The used vcf library is discarding vCard < version 4.0, where the VERSION line is NOT directly behind the "BEGIN" line.

This is contrary to the specs!

Need do fix the lib.

Actions #1

Updated by Andreas Vitting over 1 year ago

Hm, is this realy the case? If I look into VCard specs, only version 2.1 and lower VERSION field is not direct behind BEGIN. In all other version, VERSION has to be below BEGIN!

Nevertheless, many programs put the VERSION field not directly behind BEGIN (also Thunderbird add ons), so at minimum a warning should be the output - but I would not stop reading VCards from Server...

Actions #2

Updated by Jörg Ebeling over 1 year ago

If I understand the specs @ https://tools.ietf.org/html/rfc6350#section-6.7.9 right...

6.7.9.  VERSION
...
Special notes:  This property MUST be present in the vCard object,
      and it must appear immediately after BEGIN:VCARD.  The value MUST
      be "4.0" if the vCard corresponds to this specification.  Note
      that earlier versions of vCard allowed this property to be placed
      anywhere in the vCard object, or even to be absent.

... all vCards lower version 4.0 may place the VERSION line anywhere between BEGIN and END?

However, at the moment the vcf lib drops such vCards at the moment, and I've exact the same issue as you mention. When someone created a contact with such a Thunderbird plugin (like TBSync / CardDav), it has the VERSION not directly after BEGIN. So look like I need to mod that vcf lib.

Or does I misunderstood your remark?

Btw: Quite thanks for your feedback. While reading the specs again, just recognized "... or even to be absent." Wohooo!

Actions #3

Updated by Andreas Vitting over 1 year ago

The newest version 4 RFC 6350:

Interoperability considerations: The text/vcard media type is

intended to identify vCard data of any version. There are older

specifications of vCard [RFC2426][vCard21] still in common use.

While these formats are similar, they are not strictly compatible.

In general, it is necessary to inspect the value of the VERSION

property (see Section 6.7.9) for identifying the standard to which

a given vCard object conforms.

Ver. 3 (already in use), RFC 2426:

3.6.9 VERSION Type Definition

To: ietf-mime-directory@imc.org
Subject: Registration of text/directory MIME type VERSION
Type name: VERSION
Type purpose: To specify the version of the vCard specification used
to format this vCard.
Type encoding: 8bit
Type value: A single text value.
Type special notes: The property MUST be present in the vCard object.
The value MUST be "3.0" if the vCard corresponds to this
specification.
Type example:
VERSION:3.0

And in Wikipedia:

Spezifikation

vCard definiert nach der Referenzspezifikation RFC 6350 (August 2011) die folgenden Objekttypen.

Eine vCard wird als einfache, unformatierte Textdatei gespeichert. Diese besteht aus einem oder mehreren vCard-Objekten, die durch die Begrenzungen BEGIN:VCARD und END:VCARD eingeschlossen werden. Alle vCards müssen die VERSION-Eigenschaft enthalten, die die vCard-Version spezifiziert. VERSION muss direkt auf BEGIN folgen (außer im vCard-2.1-Standard, wo es überall innerhalb der vCard vorkommen darf)

!!!! THIS IS NOT CORRECT, WIKIPEDIA IS WRONG HERE !!!!!

I found an example in RFC 2426 (V3) - w/o VERSION Field:

BEGIN:VCARD

FN:Joe Friday

TEL:+1-919-555-7878

TITLE:Area Administrator

EMAIL;TYPE;INTERNET:jfriday@host.com

END:VCARD

To summarize: If not at the beginning, you have to search for VERSION to determine, which spec is correct. If not found, then below V4???

On the other site if VERSION 4 is not found after BEGIN, then it's wrong.

So you are right, lib is wrong.

Actions #4

Updated by Jörg Ebeling over 1 year ago

  • % Done changed from 0 to 10

Thanks a lot for your detailed research/analyse!!

Reading the RFC's is sometimes very annoying and confusion together, if one RFC references to the next or past :-/

I'm with your conclusion(summarize) and already did a quick look to the lib sources. Should be easily implementable.

However, I'm interested in a non-RFC-strict implementation of the vCard parser... I also need to check if the lib does anything different when parsing < "4.0" vCard versions.

Actions #5

Updated by Jörg Ebeling over 1 year ago

  • Status changed from New to In Progress
Actions #6

Updated by Jörg Ebeling over 1 year ago

  • Status changed from In Progress to Resolved
  • % Done changed from 10 to 100

Fixed vcf library and committed to public https://github.com/jhermsmeier/node-vcf/pull/39

Actions #7

Updated by Jörg Ebeling over 1 year ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF

Go to top