From d4a29130f6dc9dfdc784a86b68cc8f3459dc6160 Mon Sep 17 00:00:00 2001 From: Petru Paler Date: Thu, 8 Jan 2026 09:11:08 +0000 Subject: [PATCH] Fix feed error response rendering with to_xml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 422 error handlers were using str() to convert FT objects to HTML, which produces Python repr output instead of HTML. Changed to use to_xml() like other routes (eggs.py, products.py) do. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/animaltrack/web/routes/feed.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/animaltrack/web/routes/feed.py b/src/animaltrack/web/routes/feed.py index a8fab74..ab43c6d 100644 --- a/src/animaltrack/web/routes/feed.py +++ b/src/animaltrack/web/routes/feed.py @@ -6,7 +6,7 @@ from __future__ import annotations import time from typing import Any -from fasthtml.common import APIRouter, add_toast +from fasthtml.common import APIRouter, add_toast, to_xml from starlette.requests import Request from starlette.responses import HTMLResponse @@ -437,7 +437,7 @@ def _render_give_error( HTMLResponse with 422 status. """ return HTMLResponse( - content=str( + content=to_xml( render_page( request, feed_page( @@ -471,7 +471,7 @@ def _render_purchase_error(request, locations, feed_types, error_message): HTMLResponse with 422 status. """ return HTMLResponse( - content=str( + content=to_xml( render_page( request, feed_page(