fix: Read a VALUE parameter that lists several types - #27
Merged
Merged
Conversation
URL;VALUE=uri,text:… (written by ez-vcard) made sabre/vobject 5.0 throw a TypeError, and the whole card was lost. The Parser now keeps the first value of a repeated or listed VALUE parameter, and reports it. Upstream fix: sabre-io/vobject#795. Removing this workaround: #5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
gave an empty card and the issue
not a valid vCard: Sabre\VObject\Document::getClassNameForPropertyValue(): Argument #1 ($valueParam) must be of type string, array given. sabre/vobject readsVALUE=uri,textas a list and passes an array where it expects a string. ez-vcard writes such lines.The Parser already worked around a repeated
VALUE(VALUE=text;VALUE=TEXT), not a listed one.Fix
In the Parser pre-processing, before sabre sees the line: a
VALUEparameter with several values, repeated, listed or both, is reduced to its first value, and an issue reports it:line N repeats the VALUE parameter, kept the first one(unchanged)line N lists several values in the VALUE parameter, kept the first one(new)Only that property is affected, and the rest of the card is read as usual. A quoted
VALUE="uri,text"is left alone, because sabre reads it as a single string and doesn't crash.Keeping the types as is would not have kept them either: with
VALUE="uri,text", the URL round-trips but the VALUE is dropped without any issue.Upstream
The bug is in sabre/vobject (sabre-io/vobject#635). sabre-io/vobject#795 fixes it for both repeated and listed values. This workaround stays until we require a release that includes it; removing it is tracked in #5 (updated to cover listed values).
Tests
testListedValueParametersAreReported: the vCard above is read (FN, URL with its context), the issue is reported, and vCard → JSContact → vCard keeps the URL.testRepeatedAndListedValueParametersAreReported: both at once.make qapasses.🤖 Generated with Claude Code