From 47ee0334db780c11468fb768438e4b89220afa7d Mon Sep 17 00:00:00 2001 From: nicolas Date: Sun, 25 Jul 2021 23:22:34 +0200 Subject: [PATCH] Use better Regex to strip down html --- lib/emails/helpers.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/emails/helpers.ts b/lib/emails/helpers.ts index e5218a0a..5c07dbbe 100644 --- a/lib/emails/helpers.ts +++ b/lib/emails/helpers.ts @@ -25,5 +25,11 @@ export function getFormattedMeetingId(videoCallData: VideoCallData): string { } export function stripHtml(html: string): string { - return html.replace("
", "\n").replace(/<[^>]+>/g, ""); + const aMailToRegExp = /"]*)"[\s\w="_:#;]*>([^<>]*)<\/a>/g; + const aLinkRegExp = /"]*)"[\s\w="_:#;]*>([^<>]*)<\/a>/g; + return html + .replace(//g, "\n") + .replace(aMailToRegExp, "$1") + .replace(aLinkRegExp, "$2: $1") + .replace(/<[^>]+>/g, ""); }