fix: show subscribed calendar event details
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user