Repository navigation
ICS with multiple "STATUS" fields aren't handled correctly #1002
Description
Some Calendar tools, create ICS objects of invitations with multiple Status fields. This seems for me to happen on Kopano, when I change a reccurring invitation Item to not be recurring anymore for one day. (A.e. recurring daily meeting is rescheduled to a later point in the day).
This looks like this:
~ grep STATUS .calendars/Calendar/040000008200E00074xxxxxx9743BD251B5C9FBD.ics
STATUS:CONFIRMED
STATUS:CONFIRMED
STATUS:CONFIRMEDWhen I then want to use khal to see the events or khal interactive, following happens:
Traceback:
Traceback (most recent call last):
File "/usr/bin/khal", line 5, in <module>
main_khal()
File "/usr/lib/python3.9/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.9/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.9/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3.9/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/lib/python3.9/site-packages/khal/cli.py", line 624, in at
rows = controllers.khal_list(
File "/usr/lib/python3.9/site-packages/khal/controllers.py", line 262, in khal_list
current_events = get_events_between(
File "/usr/lib/python3.9/site-packages/khal/controllers.py", line 198, in get_events_between
event_string = event.format(agenda_format, relative_to=(start, end), env=env)
File "/usr/lib/python3.9/site-packages/khal/khalendar/event.py", line 623, in format
attributes['status'] = self.status + ' ' if self.status else ''
TypeError: can only concatenate list (not "str") to list
Debugging
Tried to debugg the issue. Looks like event.py can't handle a list of "STATUS". Tried adding a print on line 662 of event.py to print out the state:
Normal invitationICS:
~ khal at 2021-01-12 09:00
CONFIRMED
CONFIRMED
CONFIRMED
2021-01-12 09:00
09:00-10:30 meeting for this and taht
Invitation which isn't recurring for one day:
~ khal at 2021-01-11 13:00
[vText('b'CONFIRMED''), vText('b'CONFIRMED'')]
[vText('b'CONFIRMED''), vText('b'CONFIRMED'')]
[vText('b'CONFIRMED''), vText('b'CONFIRMED'')]
2021-01-11 13:00
13:00-15:00 Training ⟳
Quickfix
My quickfix for now was to add following lines inside event.py on line 661
@property
def status(self):
status=self._vevents[self.ref].get('STATUS', '')
if type(status) == list:
return status[0]
else:
return statusThis just returns only the first item of a status if it's a list. But I guess it could be done better by writing a sanitize function somewhere else.
Activity
ephase commentedon Jan 18, 2021
Hi @eyenx and thanks for your detailed report. About
STATUS, RFC say (link):So maybe we can sanitize multiple
STATUSto be compatible with such services / programs but we will not be RFC Compliantgeier commentedon May 11, 2021
At the very least, we shouldn't throw an exception (but a warning).
@eyenx can you perhaps post an anonymized version of one of those .ics files? I currently have no clear picture yet, how those multiple status occur. (Are the multiple Status all one after the other? Are they scattered through the .ics file?)
eyenx commentedon May 12, 2021
Yes, here you go. This happens, for me with KOPANO when a recurring event is moved out of the timeframe it would usually be:
d7415 commentedon May 12, 2021
While we should probably do something on the khal side too, have you also reported to this to Kopano?
eyenx commentedon May 12, 2021
d7415 commentedon May 12, 2021
It's probably worth pointing out that they're not standards compliant. Especially if you're a paying customer.
eyenx commentedon May 12, 2021
mathstuf commentedon Oct 9, 2026
I think I fixed this in #1487.