Skip to content

fix(timezone): handle duplicate TZID in VTIMEZONE without crashing (#2111) - #2112

Open
RajGahoi wants to merge 1 commit into
PyCalendar:mainfrom
RajGahoi:fix/timezone-duplicate-tzid
Open

RajGahoi wants to merge 1 commit into
PyCalendar:mainfrom
RajGahoi:fix/timezone-duplicate-tzid

Conversation

@RajGahoi

Copy link
Copy Markdown

Linked issue

Description

When parsing calendars containing duplicate TZID lines inside a VTIMEZONE component, the TZID attribute is parsed into a list of identifiers. Subsequently, cache_timezone_component() passed this list directly to clean_timezone_id(), which invoked tzid.strip("/"), causing an unhandled AttributeError: 'list' object has no attribute 'strip'.

This fix:

  1. Adds safe unpacking in Timezone.tz_name property to take the first TZID if a list is present.
  2. In TZP.cache_timezone_component, safely extracts the primary identifier if timezone_component.get("TZID") is a list, and returns early if no TZID is present.
  3. In TZP.clean_timezone_id, adds type handling to extract the first string when tzid is passed as a list.
  4. Adds regression unit test test_duplicate_tzid_in_vtimezone_does_not_crash and a towncrier news entry.

Checklist

  • I added a change log entry, following the instructions in all subsections under Change log requirements.
  • I followed icalendar's Artificial intelligence policy and disclosed my Responsible AI use in my commit messages, if applicable.
  • I added or updated tests, if applicable.
  • I ran and ensured all tests pass locally by following Run tests.
  • I added or edited documentation as necessary, both as docstrings to be rendered in the API documentation and narrative documentation, following the Style guide.

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

Mixed activity

Activity patterns show a mix of organic and automated signals.

View full analysis →

Evidence
  • Rapid fork→PR pattern: 21/27 fork branches followed by upstream PRs within 58s

Last 5 PRs:

This is an automated analysis by AgentScan

@github-actions github-actions Bot added agentscan:needs-review AgentScan flagged this item for review because it has mixed signals PR quality: good labels Nov 14, 2026
@RajGahoi
RajGahoi force-pushed the fix/timezone-duplicate-tzid branch from 7e880a4 to a36558c Compare November 14, 2026 11:22

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

agentscan:needs-review AgentScan flagged this item for review because it has mixed signals PR quality: good

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate TZID in VTIMEZONE crashes from_ical with AttributeError ('list' object has no attribute 'strip')

1 participant