From 14b95dd87492d0a969b63bc2f488201b9c2b8938 Mon Sep 17 00:00:00 2001 From: Lauri Tirkkonen Date: Tue, 2 Apr 2019 11:38:05 +0300 Subject: [PATCH 1/2] stringToDurations: initialize values to 0, not None, after ',' --- vobject/icalendar.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vobject/icalendar.py b/vobject/icalendar.py index a44fffb..7e19a0f 100644 --- a/vobject/icalendar.py +++ b/vobject/icalendar.py @@ -1913,11 +1913,11 @@ def error(msg): sec)) current = "" sign = None - week = None - day = None - hour = None - minute = None - sec = None + week = 0 + day = 0 + hour = 0 + minute = 0 + sec = 0 elif char == "eof": state = "end" else: From 0faac5ffa638370248a3c3dbb9a35306c0e5ebb0 Mon Sep 17 00:00:00 2001 From: Lauri Tirkkonen Date: Tue, 2 Apr 2019 11:38:57 +0300 Subject: [PATCH 2/2] stringToDurations: treat 'P' as 'PT0S' Microsoft Exchange generates vcal files with "TRIGGER;RELATED=START:P" for events with a reminder at time of event. --- vobject/icalendar.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vobject/icalendar.py b/vobject/icalendar.py index 7e19a0f..ba5f073 100644 --- a/vobject/icalendar.py +++ b/vobject/icalendar.py @@ -1920,6 +1920,8 @@ def error(msg): sec = 0 elif char == "eof": state = "end" + if not current: + second = '0' else: state = "error" error("got unexpected character reading in duration: " + s)