Improved robustness of ICal event parser

This commit is contained in:
Fabio Manganiello 2021-11-21 23:50:35 +01:00
parent 518d9f20c6
commit f9f9c38a8b
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -79,14 +79,16 @@ class CalendarIcalPlugin(Plugin, CalendarInterface):
event = self._translate_event(event) event = self._translate_event(event)
if event['status'] and event['responseStatus'] \ if (
and dateutil.parser.parse(event['end']['dateTime']) >= \ event['status'] != 'cancelled'
datetime.datetime.now(pytz.timezone('UTC')) \ and event['end']['dateTime']
and dateutil.parser.parse(event['end']['dateTime']).replace(tzinfo=pytz.timezone('UTC')) >=
datetime.datetime.now(pytz.timezone('UTC'))
and ( and (
(only_participating (only_participating
and event['status'] == 'confirmed' and event.get('responseStatus') in [None, 'accepted', 'tentative'])
and event['responseStatus'] in ['accepted', 'tentative']) or not only_participating)
or not only_participating): ):
events.append(event) events.append(event)
return events return events