Preserve RFC 7265 unknown property values verbatim#1450
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Documentation build overview
22 files changed ·
|
stevepiercy
left a comment
There was a problem hiding this comment.
This is exceptional work. Thank you for your effort!
Most of my suggestions are minor tweaks and clarifications, with one concern about creating a new private method instead of changing the existing one. Would you please take a look? Thank you!
Co-authored-by: Steve Piercy <web@stevepiercy.com>
|
Thanks for the thorough review! Addressed your comments. There are 2 remaining open threads on the |
stevepiercy
left a comment
There was a problem hiding this comment.
Thanks for making the changes, explaining choices made, and adding an example.
I'd like to add to the example, as shown, and it surfaced an issue. Would you please take a look? Thank you!
Co-authored-by: Steve Piercy <web@stevepiercy.com>
|
Applied the three Example suggestions (the |
|
@lcampanella98 thank you for your contribution to improve icalendar. It's a pleasure to collaborate with you. Important For maintainers, please note that the version number in the docstring in the hidden and unresolved conversation is currently |
|
Happy to contribute and collaborate. Thanks for the review! |
Linked issue
unknownvalue type is escaped/unescaped instead of kept verbatim, breaking round-trips #1445Description
Values of unrecognized properties — and
X-properties without aVALUEparameter — were run through RFC 5545 TEXT escaping, so they did not round-trip
unchanged. RFC 7265 reserves the
unknownvalue type precisely for these casesand requires the value to be carried "without processing" (§5.1/§5.2). Treating
it as TEXT re-escapes it and, as the RFC warns, "breaks round-tripping values".
Example (before this change) — in iCal the
;gains a backslash that wasn't there; in jCal the\,loses its backslash, where RFC 7265 §5.3 gives the value as"Stenophylla;Guinea\\,Africa", preserved exactly:After this change the value is preserved exactly, matching the RFC 7265 §5.3 example:
>>> print(ev.to_ical().decode()) BEGIN:VEVENT UID:1 X-COFFEE-DATA:Stenophylla;Guinea\,Africa END:VEVENT >>> ev.to_jcal() ['vevent', [['uid', {}, 'text', '1'], ['x-coffee-data', {}, 'unknown', 'Stenophylla;Guinea\\,Africa']], []]What this changes
unknownvalues are now preserved verbatim when parsing, serializing, andconverting to/from jCal. The fix skips backslash unescaping on parse and
emits the stored value unchanged on output.
VALUE(e.g.VALUE=TEXT) still getsnormal TEXT escaping, and property parameters are still decoded as before.
An unrecognized
VALUEtype keeps its type name so it round-trips losslessly.vUnknownno longer inherits fromvText, so the two cannot silently shareescaping behaviour again (per maintainer review).
PROXIMITY(RFC 9074) is now recognized asTEXTrather than falling back tothe unknown type — a latent gap this change surfaced. It had passed
test_calendar_typesonly because
vUnknownused to subclassvText.Known limitation
A jCal
unknownvalue containing a raw line break cannot be represented as abare iCal content line (RFC 7265 is silent here, and RFC 5545 makes it
impossible). This is only reachable from jCal input and fails loudly rather than
emitting invalid iCalendar. If a value genuinely needs a newline, it should be
declared
VALUE=TEXT.Checklist
/news, following the instructions in Change log entry format.Additional information
Tests are parametrized over the affected characters and conversion directions,
and cover the
VALUEboundary, unrecognized parameters,IMAGE, and thevText/vUnknownoverlap.tox -e nopytzpasses.AI disclosure: I used Claude Code (Anthropic's Claude Opus) to investigate the
bug, draft this change and its tests, and write this description. I reviewed the
output, made changes as necessary, and validated everything locally.
📚 Documentation preview 📚: https://icalendar--1450.org.readthedocs.build/en/1450/