fix: sanitize daily report HTML for Telegram parse_mode
Strip div/br tags unsupported by Telegram API; reports still store UI HTML in details Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -198,7 +198,8 @@ def _build_report_body_rdp(host: Host, stats: dict[str, Any], when_local: dateti
|
||||
|
||||
def _details_from_body(body: str, stats: dict[str, Any]) -> dict[str, Any]:
|
||||
escaped = html.escape(body)
|
||||
report_html = '<div class="agent-report">' + escaped.replace("\n", "<br>\n") + "</div>"
|
||||
# UI (Vue) допускает div; для единообразия — обёртка без br (Telegram читает через sanitize)
|
||||
report_html = f'<div class="agent-report">{escaped.replace(chr(10), "<br>")}</div>'
|
||||
return {
|
||||
"stats": stats,
|
||||
"report_body": body,
|
||||
|
||||
Reference in New Issue
Block a user