Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported TZID parm #1332

Open
mdrovdahl opened this issue Sep 19, 2023 · 1 comment
Open

Unsupported TZID parm #1332

mdrovdahl opened this issue Sep 19, 2023 · 1 comment
Labels

Comments

@mdrovdahl
Copy link

I'm working with some .ics files generated by an online platform (teamsnap.com) that include a TZID component that is causing Radicale (actually vobject) to error:

Sample .ics

BEGIN:VCALENDAR
PRODID;X-RICAL-TZSOURCE=TZINFO:-//com.denhaven2/NONSGML ri_cal gem//EN
CALSCALE:GREGORIAN
VERSION:2.0
X-WR-CALNAME:Bainbridge Island FC B08 White
X-WR-CALDESC:The event schedule for the Bainbridge Island FC B08 White So
 ccer team
X-WR-TIMEZONE:America/Los_Angeles
X-PUBLISHED-TTL:PT1H
X-TS-TIMESTAMP:2023-09-19 11:53:05
BEGIN:VEVENT
DTEND;TZID=America/Los_Angeles;VALUE=DATE-TIME:20230626T190000
DTSTART;TZID=America/Los_Angeles;VALUE=DATE-TIME:20230626T173000
DTSTAMP;VALUE=DATE-TIME:20230611T002230Z
LAST-MODIFIED;VALUE=DATE-TIME:20230611T002230Z
DESCRIPTION:(Arrival Time:  5:21 PM (Pacific Time (US & Canada))) 
SUMMARY:Soccer team B08 White - B08 Training
LOCATION:High School Turf
SEQUENCE:0
UID:347d986b3625741bd5bdfbb1b4480f314d31d98e784bb3bd5f1a75bc60d3a26c
END:VEVENT
BEGIN:VTIMEZONE
TZID;X-RICAL-TZSOURCE=TZINFO:America/Los_Angeles
BEGIN:DAYLIGHT
DTSTART:20230312T020000
RDATE:20230312T020000
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
TZNAME:PDT
END:DAYLIGHT
BEGIN:STANDARD
DTSTART:20231105T020000
RDATE:20231105T020000
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
TZNAME:PST
END:STANDARD
END:VTIMEZONE

I spent a fair bit searching for related issues (like this ics-py/ics-py#268). My workaround, for now, is to modify read.components():

def read_components(s: str) -> List[vobject.base.Component]:

to include:

    # Workaround for bug in Timezone data
    s = re.sub(r"(TZID;X-RICAL-TZSOURCE=TZINFO:)", r"TZID:", s)
@da4089
Copy link
Contributor

da4089 commented Mar 2, 2024

This ICS file (with the addition of an "END:VCALENDAR" line, which I assume got lost in cut&paste), passes RFC-5545 validation at https://icalendar.org/validator.html.

vObject raises:

Error
Traceback (most recent call last):
  File "/Users/d/work/personal/vobject/vobject/base.py", line 185, in transformToNative
    return self.behavior.transformToNative(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/d/work/personal/vobject/vobject/icalendar.py", line 1093, in transformToNative
    obj.registerTzinfo(obj.tzinfo)
                       ^^^^^^^^^^
  File "/Users/d/work/personal/vobject/vobject/icalendar.py", line 159, in gettzinfo
    return tz.tzical(buffer).get()
           ^^^^^^^^^^^^^^^^^
  File "/Users/d/work/personal/vobject/venv312/lib/python3.12/site-packages/dateutil/tz/tz.py", line 1279, in __init__
    self._parse_rfc(fobj.read())
  File "/Users/d/work/personal/vobject/venv312/lib/python3.12/site-packages/dateutil/tz/tz.py", line 1443, in _parse_rfc
    raise ValueError(
ValueError: unsupported TZID parm: =TZINFO

Those last two lines show the issue originating in dateutil, and looking at the relevant function, it has:

if name == "TZID":
    if parms:
        raise ValueError(
            "unsupported TZID parm: "+parms[0])
    tzid = value

This reflects the conclusion in ics-py/ics-py#268 (as referenced above).
So this needs either a fix to dateutil or some sort of work-around (in vObject).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants