Skip to content

Fix escaping of REQUEST-STATUS field separators - #2124

Open
Prajas02 wants to merge 2 commits into
PyCalendar:mainfrom
Prajas02:fix-request-status-escaping
Open

Prajas02 wants to merge 2 commits into
PyCalendar:mainfrom
Prajas02:fix-request-status-escaping

Conversation

@Prajas02

Copy link
Copy Markdown

Closes #2123

What this changes

REQUEST-STATUS was written with escaped field separators (2.0\;Success), which is not valid RFC 5545 and is not readable by other clients. Parsing also split a field at an escaped \;.

vRequestStatus already stores its value in the escaped wire form (new() escapes each field and the description/data accessors unescape them), so the fix makes the reader and writer agree with that:

  • vRequestStatus.to_ical() writes the value as is, without escaping the separators again.
  • vRequestStatus.get_value_from_content_line() hands the raw, still escaped value to the type. This uses the hook the parser already offers for value types that must not be unescaped (as vUnknown does).
  • Values written by older versions of icalendar (2.0\;Success) are detected and unescaped once, so existing files are still read correctly.
  • Newlines in the description or data are escaped as \n, so they cannot break the content line.

Before / after

Input or call Before After
vRequestStatus.new("3.1", "Invalid property value", "DTSTART:96-Apr-01") 3.1\;Invalid property value\;DTSTART:96-Apr-01 3.1;Invalid property value;DTSTART:96-Apr-01
parse 2.0;Success\; with note;x\,y description Success, data with note;x,y description Success; with note, data x,y
parse legacy 2.0\;Success (2, 0), Success (2, 0), Success

Tests

  • Every RFC 5545 example is written without escaped separators, parsed into the right fields, and survives parse then serialize byte for byte.
  • Values written by older versions are still parsed.
  • Newlines in fields are escaped and round trip.

14 of the new tests fail on main and pass with this change. The full test suite and ruff pass.

Checklist

  • Tests added
  • News fragment added in news/
  • I used AI to assist me with this change and reviewed the result.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the pull request, @Prajas02! A maintainer will review it shortly.

@github-actions

Copy link
Copy Markdown
Contributor

Insufficient data

Not enough activity yet to make a reliable assessment.

View full analysis →

This is an automated analysis by AgentScan

@github-actions github-actions Bot added the ai-suspicion This contribution is possibly created with lots of AI help without enough human understanding. label Nov 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

One or more PR-quality checks did not pass. Review the PR Quality Checks summary in the workflow run for the failed checks and their details, then make any necessary updates.

Checklist items may remain unchecked while work is in progress. Please tick each item as you complete it.

If you used AI assistance, follow the project's Responsible AI use policy and provide the required disclosures.

@angatha

angatha commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Thank you for the contribution. Please follow our responsible AI usage and clarify how you used AI. The policy is linked below. PLease read it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-suspicion This contribution is possibly created with lots of AI help without enough human understanding.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REQUEST-STATUS is serialized with escaped field separators and parsed incorrectly

2 participants