Skip to content

Self-hosted AI workspace.

Python

fix(reminders): sanitize ntfy Title header to ASCII (#5208)

Am-GJ851bf4d0c85c
diff --git a/routes/note_routes.py b/routes/note_routes.py
index 3d356f5c9..ec8d14925 100644
--- a/routes/note_routes.py
+++ b/routes/note_routes.py
@@ -479,7 +479,9 @@ async def dispatch_reminder(
base = intg["base_url"].rstrip("/")
topic = settings.get("reminder_ntfy_topic") or "reminders"
ntfy_body = synthesis or note_body or title
- hdrs = {"Title": title or "Reminder", "Priority": "high", "Tags": "bell"}
+ # ntfy Title is an ASCII HTTP header; sanitize Unicode and cap its length.
+ _clean_title = (title or "Reminder").encode("ascii", "replace").decode("ascii")[:200]
+ hdrs = {"Title": _clean_title, "Priority": "high", "Tags": "bell"}
api_key = intg.get("api_key", "")
if api_key:
hdrs["Authorization"] = f"Bearer {api_key}"