From c4b039886e990e03d6e18edc6f73449caab383ca Mon Sep 17 00:00:00 2001 From: Lety Does Stuff <48048071+letydoesstuff@users.noreply.github.com> Date: Thu, 15 Feb 2024 13:39:59 +0000 Subject: [PATCH] Fix the escapeAttribute function using HTML entities instead of backslash escapes (#6206) * Fix the escapeAttribute function using HTML entities instead of backslash escapes * Fix tests --------- Co-authored-by: Chocobozzz --- packages/core-utils/src/renderer/html.ts | 2 +- packages/tests/src/client/og-twitter-tags.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/core-utils/src/renderer/html.ts b/packages/core-utils/src/renderer/html.ts index fb4f19ac0..c12d5aa7b 100644 --- a/packages/core-utils/src/renderer/html.ts +++ b/packages/core-utils/src/renderer/html.ts @@ -73,5 +73,5 @@ export function escapeHTML (stringParam: string) { export function escapeAttribute (value: string) { if (!value) return '' - return String(value).replace(/"/g, '\\"') + return String(value).replace(/"/g, '"') } diff --git a/packages/tests/src/client/og-twitter-tags.ts b/packages/tests/src/client/og-twitter-tags.ts index e8ddc7c9b..d5480087d 100644 --- a/packages/tests/src/client/og-twitter-tags.ts +++ b/packages/tests/src/client/og-twitter-tags.ts @@ -273,8 +273,8 @@ describe('Test Open Graph and Twitter cards HTML tags', function () { const res = await makeGetRequest({ url: servers[0].url, path: '/a/root', accept: 'text/html', expectedStatus: HttpStatusCode.OK_200 }) const text = res.text - expect(text).to.contain(``) - expect(text).to.contain(``) + expect(text).to.contain(``) + expect(text).to.contain(``) }) })