Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix: restrict catalogue formatting to known email tags
Richie McIlroy6cd9ffe36ee2
diff --git a/scripts/emails/catalog.test.ts b/scripts/emails/catalog.test.tsindex fc56bb276..f46d2bafb 100644--- a/scripts/emails/catalog.test.ts+++ b/scripts/emails/catalog.test.ts@@ -14,6 +14,9 @@ import { assertEmailContent, normalizeLmx } from "./content";describe("email library", () => {test("catalogue excerpts keep malformed markup inert", () => {+ expect(catalogExcerpt("<script>alert(1)</script>")).toBe(+ "<script>alert(1)</script>",+ );expect(catalogExcerpt("<Paragraph>Hello</Paragraph><script src=x")).toBe("Hello\n\n<script src=x",);diff --git a/scripts/emails/catalog.ts b/scripts/emails/catalog.tsindex 27cce50ca..6e0f22f9f 100644--- a/scripts/emails/catalog.ts+++ b/scripts/emails/catalog.ts@@ -182,7 +182,7 @@ export const catalogExcerpt = (body: string) =>body.replace(/<\/(Paragraph|Button)>/g, "\n\n").replace(/<Br\s*\/>/g, "\n")- .replace(/<[^>]+>/g, "")+ .replace(/<\/?(?:Paragraph|Button|Link|Strong|Em)\b[^>]*>/g, "").replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">")