From 19ea04507dd01db26e309abcbb135b673524371d Mon Sep 17 00:00:00 2001 From: yunggilja Date: Sun, 31 May 2026 20:24:38 -0500 Subject: [PATCH] Fix Python 3.11 compatibility in calendar .ics export calendar_routes.py used a backslash inside an f-string expression, valid only on Python 3.12+. Hoist the newline-escaping out of the f-string so the app imports on Python 3.11, as the README states. Co-Authored-By: Claude Opus 4.8 --- routes/calendar_routes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/routes/calendar_routes.py b/routes/calendar_routes.py index 284e6c689..d4876662e 100644 --- a/routes/calendar_routes.py +++ b/routes/calendar_routes.py @@ -902,7 +902,11 @@ def setup_calendar_routes() -> APIRouter: lines.append(f"DTSTART:{ev.dtstart.strftime('%Y%m%dT%H%M%S')}") lines.append(f"DTEND:{ev.dtend.strftime('%Y%m%dT%H%M%S')}") if ev.description: - lines.append(f"DESCRIPTION:{ev.description.replace(chr(10), '\\n')}") + # Escape newlines to the literal \n the iCalendar spec wants. + # Kept out of the f-string expression so this stays valid on + # Python 3.11 (backslashes in f-string expressions need 3.12+). + _desc = ev.description.replace(chr(10), "\\n") + lines.append(f"DESCRIPTION:{_desc}") if ev.location: lines.append(f"LOCATION:{ev.location}") if ev.rrule: