Parse x-property values as unknown values and fix parsing structured values #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changes how values of extended properties ("x-properties") are parsed and encoded for vCards. Until now, such values were parsed and encoded as TEXT values. Now they are handled as values of unknown type.
In addition to changing the default value to X-VALUE, this adds a callback to the vCard parser so that libicalvcard callers can specify he value kind per parsed x-property.
Handling these values as TEXT was incorrect: neither vCard 4 (RFC 6350) nor vCard 3 (RFC 2426) defined extended properties to have default value TEXT. This is in contrast to iCalendar which does define their default value to be TEXT (RFC 5545, Section 3.8.8.2).
This was especially problematic because in vCard the COMMA and SEMICOLON characters signify a separator for structured values. Parsing values as TEXT caused these characters to be leniently read as unescaped characters but then become escaped during encoding. As a result, values of x-properties containing these characters differed from their original when encoded, which could change semantics.
It also fixes a couple of bugs when parsing and encoding structured values.