From e96a8e0a20a47f57ecb36d9d4e005f0af41e496e Mon Sep 17 00:00:00 2001 From: Farnabaz Date: Tue, 25 Jul 2023 17:32:33 +0200 Subject: [PATCH 1/2] fix(prerender): link extraction regex respect encoded html --- src/prerender.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/prerender.ts b/src/prerender.ts index c367d165a6..c37e280074 100644 --- a/src/prerender.ts +++ b/src/prerender.ts @@ -300,7 +300,7 @@ async function runParallel( await refillQueue(); } -const LINK_REGEX = /href=["']?([^"'>]+)/g; +const LINK_REGEX = /href=(?!")["']?([^"'>]+)/g; function extractLinks( html: string, From df10b57dfe50d6b0a7a17cbcd5d583838cfe2fc9 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Mon, 7 Aug 2023 00:48:59 +0200 Subject: [PATCH 2/2] add reproduction to the tests --- test/fixture/routes/prerender.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/fixture/routes/prerender.ts b/test/fixture/routes/prerender.ts index 0b89ee3eee..8ec45cc25d 100644 --- a/test/fixture/routes/prerender.ts +++ b/test/fixture/routes/prerender.ts @@ -34,6 +34,8 @@ ${links.map((link) => `
  • ${link}
  • `).join("\n")} /* Bad Link Examples */ x-href attr + + <a href="/500</a> `; });