Skip to content

fix: encode property parameter values as defined by RFC 6868 - #774

Open
gaoflow wants to merge 1 commit into
sebbo2002:developfrom
gaoflow:fix-rfc6868-parameter-encoding
Open

fix: encode property parameter values as defined by RFC 6868#774
gaoflow wants to merge 1 commit into
sebbo2002:developfrom
gaoflow:fix-rfc6868-parameter-encoding

Conversation

@gaoflow

@gaoflow gaoflow commented Jul 26, 2026

Copy link
Copy Markdown

Parameter values go through the TEXT escaping of RFC 5545, but RFC 6868 defines a separate caret encoding for them. Three consequences: " is dropped (the stopgap from #753 — the repo's own generate_06.ics turns Smith, Matt; ("Sales") into (Sales)), a literal ^ is passed through unencoded so a^nb decodes back as a + newline + b, and a line break becomes \n instead of ^n. Separately DELEGATED-TO/DELEGATED-FROM were not escaped at all, and the unquoted parameters keep the backslash escaping, so X-TITLE=Standup: Room 3 truncates to Standup — both Thunderbird's ical.js and Python icalendar read it that way, and icalendar drops the whole ATTENDEE property when a parameter holds a bare ".

Adds escapeParameterValue() / quoteParameterValue() and routes all 14 parameter-emitting call sites through them, building on #763 which had already pointed attendee SENT-BY at escape(…, true) — that value now survives instead of being stripped. The four fixture updates and the two escape(…, true) unit tests are the old strip-the-quote behaviour being corrected. Tested by round-tripping 14 sites × 12 values through ical.js and Python icalendar (114 of 168 cases failed before, 0 after), plus npm test (606 passing), eslint, prettier and tsc.

Parameter values were escaped as if they were TEXT values. RFC 6868 defines
the caret encoding (^^, ^', ^n) for them instead, so a `"` was dropped, a
literal `^` was written unencoded and a line break became the TEXT escape.
Two parameters, DELEGATED-TO and DELEGATED-FROM, were not escaped at all.

Adds escapeParameterValue() and quoteParameterValue() and routes every
parameter emitting call site through them. Unquoted values containing ; : or ,
are now quoted, as RFC 5545 section 3.2 requires.
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