Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Adds support for vCard 2.1 #389

Closed
wants to merge 4 commits into from
Closed

[WIP] Adds support for vCard 2.1 #389

wants to merge 4 commits into from

Conversation

caugner
Copy link
Contributor

@caugner caugner commented Apr 5, 2019

Fixes #187.

  • [1] Support QUOTED-PRINTABLE inline encoding [cf. Section 2.1.2].
  • [2] Do not interpret "\n" or "\N" as a CRLF(but instead literally as "\", followed by "n" or "N").
  • [3] Do not interpret COMMA as a multi-value separator [all values are single values].
  • [3] Note: Despite what vCard 3.0 states, a SEMICOLON must also be backslash escaped in vCard 2.1. "in a component of a compound property" [cf. Section 2.1.3]
  • [4] Require VERSION to be "2.1" [cf. Section 2.6.6].
  • [5] [6] n/a
  • [7] Support CHARSET type parameter [and default to ASCII, cf. 2.1.6].
  • [8] Support non-significant WSP characters [i.e. HTAB, cf. 2.9].
  • [9] Don't require parameter name, if the value is unambiguous [e.g. for TYPE= and ENCODING=, cf. 2.1.2].
  • [10] Require TYPE of LOGO [cf. 2.5.3.1], PHOTO [cf. 2.2.3.1] and SOUND [cf. 2.6.3.1] as defined by the spec [e.g. GIF].
  • [11] Parse inline binary content according to ENCODING parameter [and default to 7-bit, cf. 2.1.5].
  • [12] Do not support the PCS type parameter value for TEL [from vCard 3.0].
  • [13] Do not support CATEGORIES, CLASS, NICKNAME, PRODID and SORT-STRING [from vCard 3.0].
  • [14] Do not require N and FN [Note: N is only required for writers, not for readers, cf. 2.2.2].
  • [14] Note: Despite what vCard 3.0 states, VERSION is also required in vCard 2.1 [cf. [4] and 2.6.6].
  • [...] Use COMMA to separate GEO values [cf. 2.4.6 versus SEMICOLON in vCard 3.0]
  • [MR] Add tests.
  • [MR] Fix test coverage.

@skjnldsv
Copy link

skjnldsv commented Apr 5, 2019

Awesome!! @caugner
Let me know if I can be any help!

@coveralls
Copy link

coveralls commented Apr 6, 2019

Coverage Status

Coverage decreased (-0.2%) to 96.764% when pulling 23a1d4a on caugner:187-support-vcard-2.1 into 2b4e50d on mozilla-comm:master.

@tasn
Copy link

tasn commented Jul 16, 2019

Glad to see you are working on it, life saver!

I tried testing it, but am getting "unsupported vCard version" with a vCard 4.0. Taking a brief look at the code, it look like your switch statement only handles 3.0 and 2.1 (though it could be intentional in that specific spot).

@caugner
Copy link
Contributor Author

caugner commented Jul 21, 2019

@tasn Can you share the vCard 4.0 which triggered the error? It sounds as if the vCard combines properties of vCard 3 and 4, because this switch statement should only be evaluated for vCards other than 4.0: !(name === 'version' && value === '4.0')

@@ -228,6 +231,8 @@ ICAL.parse = (function() {
);
}

var debug = line.includes("37.386013");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var debug = line.includes("37.386013");

@tasn
Copy link

tasn commented Jul 21, 2019

Apologies for the noise!
I just checked following your comment and it seems that the failing one is a purposefully malformed entry I created. Interesting that none of the other clients (ez-vcard, python-vobject) fail when they get to it.

I guess you can ignore my comment. The entry for reference:

BEGIN:VCARD
PRODID;VALUE=TEXT:-//iCal.js EteSync Web
VERSION:4.0
UID:0561483d-251d-44e7-bb63-0cfd6285ffe3
FN:This contact checks broken vcard version
REV;VALUE=DATE-TIME:20190503T091907
IMPP;TYPE=jabber:jabber:
END:VCARD

@stefan123t
Copy link

regarding [1] there are two old issues at nextcloud contacts & server with some example ENCODING=QUOTED-PRINTABLE characters of danish and german users in case you want to extend your test case vcard21.vcf

nextcloud/contacts#584
nextcloud/server#10653

@kewisch kewisch deleted the branch kewisch:master December 5, 2021 13:41
@kewisch kewisch closed this Dec 5, 2021
@tasn
Copy link

tasn commented Dec 6, 2021

I guess this was accidentally closed because of the deletion of master?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support VCard 2.1
6 participants