fix: htmlToText preserve <a> href links for activation email parsing

This commit is contained in:
zimk
2026-03-16 19:29:58 +08:00
parent f144afeb80
commit d3c8f691b5

View File

@@ -126,7 +126,8 @@ function htmlToText(html) {
return html
.replace(/<style[\s\S]*?<\/style>/gi, "")
.replace(/<script[\s\S]*?<\/script>/gi, "")
.replace(/<br\s*\/?\s*>/gi, "\n")
.replace(/<a\s+[^>]*href=["']([^"']+)["'][^>]*>/gi, (_, href) => href + " ")
.replace(/<br\s*\/?>\s*/gi, "\n")
.replace(/<\/p>/gi, "\n")
.replace(/<[^>]+>/g, "")
.replace(/&nbsp;/gi, " ")