From 15599b9f01dc610ef4e2dad81c6d3e639bf7148d Mon Sep 17 00:00:00 2001 From: domverse Date: Wed, 25 Mar 2026 22:04:25 +0100 Subject: [PATCH] fix: add tojson Jinja2 filter to fix 500 on replica detail page FastAPI's Jinja2Templates doesn't include Flask's tojson filter. Register json.dumps as the tojson filter so replica_detail.html can safely embed replica.name in a JS string literal. Co-Authored-By: Claude Sonnet 4.6 --- app/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/main.py b/app/main.py index 7e02612..16aa2ea 100644 --- a/app/main.py +++ b/app/main.py @@ -128,8 +128,10 @@ def create_app() -> FastAPI: ) # Templates + import json as _json templates_dir = Path(__file__).parent / "templates" templates = Jinja2Templates(directory=str(templates_dir)) + templates.env.filters["tojson"] = _json.dumps # Register UI routes (must come before API to avoid catch-all conflicts) from .ui.routes import router as ui_router, setup_templates