fix: add tojson Jinja2 filter to fix 500 on replica detail page
All checks were successful
Deploy / deploy (push) Successful in 17s

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 <noreply@anthropic.com>
This commit is contained in:
2026-03-25 22:04:25 +01:00
parent dd051e0f92
commit 15599b9f01

View File

@@ -128,8 +128,10 @@ def create_app() -> FastAPI:
) )
# Templates # Templates
import json as _json
templates_dir = Path(__file__).parent / "templates" templates_dir = Path(__file__).parent / "templates"
templates = Jinja2Templates(directory=str(templates_dir)) templates = Jinja2Templates(directory=str(templates_dir))
templates.env.filters["tojson"] = _json.dumps
# Register UI routes (must come before API to avoid catch-all conflicts) # Register UI routes (must come before API to avoid catch-all conflicts)
from .ui.routes import router as ui_router, setup_templates from .ui.routes import router as ui_router, setup_templates