diff --git a/backend/open_webui/utils/automations.py b/backend/open_webui/utils/automations.py index 7df4c399aa..557e84ce13 100644 --- a/backend/open_webui/utils/automations.py +++ b/backend/open_webui/utils/automations.py @@ -89,9 +89,9 @@ def _parse_rule(s: str, now: Optional[datetime] = None): rule = rules[0] start = rule._dtstart.replace(tzinfo=None) anchor = now or datetime.now() - lines = s.splitlines() - stripped = '\n'.join(line for line in lines if not line.upper().startswith('DTSTART')) or s - has_dtstart = any(line.upper().startswith('DTSTART') for line in lines) + parts = s.split() + stripped = '\n'.join(part for part in parts if not part.upper().startswith('DTSTART')) or s + has_dtstart = any(part.upper().startswith('DTSTART') for part in parts) step = { SECONDLY: timedelta(seconds=rule._interval), MINUTELY: timedelta(minutes=rule._interval), @@ -183,9 +183,7 @@ def rrule_interval_seconds(s: str) -> Optional[int]: Returns None for one-shot (COUNT=1) schedules or rules with fewer than two future occurrences. """ - if 'COUNT=1' in s: - return None - s = '\n'.join(line for line in s.splitlines() if not line.upper().startswith('DTSTART')) or s + s = '\n'.join(part for part in s.split() if not part.upper().startswith('DTSTART')) or s now = datetime.now() rule = _parse_rule(s, now) first = rule.after(now) diff --git a/backend/open_webui/utils/calendar.py b/backend/open_webui/utils/calendar.py index 1ce590203a..0406db38f6 100644 --- a/backend/open_webui/utils/calendar.py +++ b/backend/open_webui/utils/calendar.py @@ -44,7 +44,7 @@ def expand_recurring_event( original_start_ns = event_dict['start_at'] original_start = to_local_datetime(original_start_ns) - rule_str = '\n'.join(line for line in rrule_str.splitlines() if not line.upper().startswith('DTSTART')) or rrule_str + rule_str = '\n'.join(part for part in rrule_str.split() if not part.upper().startswith('DTSTART')) or rrule_str try: # Anchor to the event's real start so day-of-week / day-of-month are correct