Update src/server/generate_form.py

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Adam Moussa 2026-07-30 18:32:39 -04:00 • committed by GitHub
parent 57a6412811
commit a9dcf28d09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,8 +38,13 @@ def latest_menu() -> dict:
def _json_for_script(value) -> str:
"""Serialize for embedding in a <script> tag; escape </ to avoid early close."""
return json.dumps(value, separators=(",", ":")).replace("</", "<\\/")
"""Serialize for embedding in a <script> tag; escape < and JS line separators."""
return (
json.dumps(value, separators=(",", ":"))
.replace("<", "\\u003c")
.replace("\u2028", "\\u2028")
.replace("\u2029", "\\u2029")
)
def generate_form(