fix(formatters): strip HTML from comment bodies so bot notifications render cleanly

This commit is contained in:
RhenCloud committed 2026-08-15 17:55:38 +08:00
1 parent fa227b1533
commit 3af50496a7
6 files changed
+74 -9

No files matched your search

+2 -2
View File
@@ -1,6 +1,6 @@
import type { NeutralMessage, NeutralAuthor } from "../types";
import { GITHUB_COLORS } from "./colors";
import { emojiPrefix, type T, buildMessage } from "./helpers";
import { emojiPrefix, type T, buildMessage, htmlToText } from "./helpers";
export function formatIssueComment(
payload: Record<string, unknown>,
@@ -22,7 +22,7 @@ export function formatIssueComment(
const al = t("actions." + action) ?? action;
const em = (e: string): string => emojiPrefix(e, showEmoji);
const commentBody = comment.body?.slice(0, 500) ?? "";
const commentBody = htmlToText(comment.body ?? "").slice(0, 500);
const truncated = comment.body && comment.body.length > 500;
return buildMessage(