From bab35e9692c6e31b88672aaa2f7a778a34a3b8cd Mon Sep 17 00:00:00 2001 From: Unrud Date: Wed, 7 Jun 2017 21:54:38 +0200 Subject: [PATCH] Detect errors in recurrence rules early --- radicale/storage.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/radicale/storage.py b/radicale/storage.py index f77143c..75099ca 100644 --- a/radicale/storage.py +++ b/radicale/storage.py @@ -118,9 +118,16 @@ def check_item(vobject_item): """Check vobject items for common errors.""" if vobject_item.name == "VCALENDAR": for component in vobject_item.components(): - if (component.name in ("VTODO", "VEVENT", "VJOURNAL") and - not get_uid(component)): + if component.name not in ("VTODO", "VEVENT", "VJOURNAL"): + continue + if not get_uid(component): raise ValueError("UID in %s is missing" % component.name) + # vobject interprets recurrence rules on demand + try: + component.rruleset + except Exception as e: + raise ValueError("invalid recurrence rules in %s" % + component.name) from e elif vobject_item.name == "VCARD": if not get_uid(vobject_item): raise ValueError("UID in VCARD is missing")