Skip to content

fix: KEY and SOUND are URIs in vCard 4.0 - #799

Open
odolbeau wants to merge 1 commit into
sabre-io:masterfrom
odolbeau:fix/key-sound-uri-in-vcard4
Open

odolbeau wants to merge 1 commit into
sabre-io:masterfrom
odolbeau:fix/key-sound-uri-in-vcard4

Conversation

@odolbeau

@odolbeau odolbeau commented Oct 2, 2026

Copy link
Copy Markdown

In vCard 4.0, KEY and SOUND hold a URI by default (RFC 6350, sections 6.7.5 and 6.8.1). A text KEY needs VALUE=text. sabre maps both to FlatText, though, and only switches PHOTO and LOGO to Uri for vCard 4.0. So a vCard 4.0 KEY or SOUND:

  • is exported to jCard as ["key", {}, "text", "https://…"] and to xCard as <text>, where RFC 7095 and RFC 6351 use uri;
  • never reaches the SOUND branch of VCardConverter. The 4.0 to 3.0 conversion turns Uri PHOTO, LOGO and SOUND values into binary, but SOUND is not a Uri, so a data: URI stays as is.

Change

VCard::getClassNameForPropertyName() returns Property\Uri for KEY and SOUND in vCard 4.0, next to the existing switch from Binary to Uri.

Unchanged:

  • vCard 3.0 and 2.1, where KEY and SOUND keep their current class;
  • a 4.0 KEY with VALUE=text, which stays text.

Two xCard tests change: XmlTest::testRFC6350Section6Part7Part5 (SOUND) and testRFC6350Section6Part8Part1 (KEY). Each wrote the value back as <text>, while the RFC examples they use are URIs. In the SOUND test, the first assertion already uses <uri>. They now expect <uri>.

Tests

tests/VObject/Component/VCardKeySoundTest.php covers the class and jCard type in vCard 4.0, a text KEY, unchanged vCard 3.0, and the conversion of a SOUND data: URI to binary in vCard 3.0. Two of its tests fail without the fix.

🤖 Generated with Claude Code

RFC 6350 makes KEY and SOUND URIs by default in vCard 4.0, but they
mapped to FlatText: jCard and xCard gave them the text type, and the
4.0 to 3.0 conversion never reached its SOUND branch. They now map to
Property\Uri in vCard 4.0, as PHOTO and LOGO already do.

The xCard tests of the RFC 6350 SOUND and KEY examples now expect
<uri>, the type of those examples.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant