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:
PTah
2026-05-29 16:35:04 +10:00
parent 0baeacf808
commit 2670c8cb46
4 changed files with 37 additions and 9 deletions
+6
View File
@@ -10,6 +10,12 @@ def test_html_escape_special_chars():
assert html_escape("a<b>&") == "a&lt;b&gt;&amp;"
def test_sanitize_telegram_html_keeps_bold():
from app.services.telegram_templates import sanitize_telegram_html
assert sanitize_telegram_html("<b>title</b><br>line") == "<b>title</b>\nline"
def test_rdp_failed_template_includes_user_ip_logon():
host = Host(hostname="K6A-DC3", display_name="UNMS Kalina", os_family="windows")
event = Event(