fix: encode property parameter values as defined by RFC 6868 - #774
Open
gaoflow wants to merge 1 commit into
Open
fix: encode property parameter values as defined by RFC 6868#774gaoflow wants to merge 1 commit into
gaoflow wants to merge 1 commit into
Conversation
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.
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.
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 owngenerate_06.icsturnsSmith, Matt; ("Sales")into(Sales)), a literal^is passed through unencoded soa^nbdecodes back asa+ newline +b, and a line break becomes\ninstead of^n. SeparatelyDELEGATED-TO/DELEGATED-FROMwere not escaped at all, and the unquoted parameters keep the backslash escaping, soX-TITLE=Standup: Room 3truncates toStandup— both Thunderbird's ical.js and Pythonicalendarread it that way, andicalendardrops 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 attendeeSENT-BYatescape(…, true)— that value now survives instead of being stripped. The four fixture updates and the twoescape(…, true)unit tests are the old strip-the-quote behaviour being corrected. Tested by round-tripping 14 sites × 12 values through ical.js and Pythonicalendar(114 of 168 cases failed before, 0 after), plusnpm test(606 passing), eslint, prettier and tsc.