fix: show subscribed calendar event details
ci / gitleaks (push) Successful in 1m23s
ci / docker (push) Successful in 4m14s

This commit is contained in:
2026-09-20 22:16:13 +08:00
parent 3a73473c4d
commit 99da524070
2 changed files with 30 additions and 0 deletions
+6
View File
@@ -18,6 +18,8 @@ from icalendar import Calendar
MAX_ICS_BYTES = 2_000_000
MAX_REDIRECTS = 3
DEFAULT_RECURRENCE_LIMIT = 10_000
MAX_DESCRIPTION_LENGTH = 2_000
MAX_LOCATION_LENGTH = 500
TIMEOUT_SECONDS = 10
_ALLOWED_CONTENT_TYPES = {"text/calendar", "text/plain", "application/octet-stream"}
@@ -159,9 +161,13 @@ def _overlaps(start: datetime, end: datetime, window_start: datetime, window_end
def _event_dict(event: Any, source_id: str, source: str, color: str, start: datetime, end: datetime, all_day: bool) -> dict:
uid = str(event.get("uid") or "")
title = str(event.get("summary") or "Untitled event").strip() or "Untitled event"
description = str(event.get("description") or "").strip()[:MAX_DESCRIPTION_LENGTH]
location = str(event.get("location") or "").strip()[:MAX_LOCATION_LENGTH]
return {
"id": f"{uid or title}:{start.isoformat()}",
"title": title,
"description": description or None,
"location": location or None,
"starts_at": start,
"ends_at": end,
"all_day": all_day,