From 0e35ab1baf1fe56ece99e64e8b89852513f69641 Mon Sep 17 00:00:00 2001 From: Unrud Date: Wed, 7 Jun 2017 15:31:05 +0200 Subject: [PATCH] Fix detection of infinite recurrence * The RRULE field might not exist. * vobject also accepts lower case COUNT and UNTIL. --- radicale/xmlutils.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/radicale/xmlutils.py b/radicale/xmlutils.py index ff91f822..d56141e0 100644 --- a/radicale/xmlutils.py +++ b/radicale/xmlutils.py @@ -284,8 +284,9 @@ def _visit_time_ranges(vobject_item, child_name, range_fn, infinity_fn): dtstart = child.dtstart.value if child.rruleset: - if (";UNTIL=" not in child.rrule.value and - ";COUNT=" not in child.rrule.value): + if (hasattr(child, "rrule") and + ";UNTIL=" not in child.rrule.value.upper() and + ";COUNT=" not in child.rrule.value.upper()): for dtstart in child.getrruleset(addRDate=True): if infinity_fn(_date_to_datetime(dtstart)): return @@ -357,8 +358,9 @@ def _visit_time_ranges(vobject_item, child_name, range_fn, infinity_fn): created = _date_to_datetime(created.value) if child.rruleset: - if (";UNTIL=" not in child.rrule.value and - ";COUNT=" not in child.rrule.value): + if (hasattr(child, "rrule") and + ";UNTIL=" not in child.rrule.value.upper() and + ";COUNT=" not in child.rrule.value.upper()): for reference_date in child.getrruleset(addRDate=True): if infinity_fn(_date_to_datetime(reference_date)): return @@ -432,8 +434,9 @@ def _visit_time_ranges(vobject_item, child_name, range_fn, infinity_fn): if dtstart is not None: dtstart = dtstart.value if child.rruleset: - if (";UNTIL=" not in child.rrule.value and - ";COUNT=" not in child.rrule.value): + if (hasattr(child, "rrule") and + ";UNTIL=" not in child.rrule.value.upper() and + ";COUNT=" not in child.rrule.value.upper()): for dtstart in child.getrruleset(addRDate=True): if infinity_fn(_date_to_datetime(dtstart)): return