From 9662db1ec30be6b1155a27dfe4dfbf8907c59cdb Mon Sep 17 00:00:00 2001 From: Sven Date: Wed, 18 Mar 2026 17:41:47 +0100 Subject: [PATCH] fix(patches): correct template literal escaping in livefetch patch The nested template literal in the patch output had over-escaped regex and backticks (\\\\/ instead of \\/, \\\` instead of \`), producing invalid JS that caused a SyntaxError at runtime. Co-Authored-By: Claude Opus 4.6 --- scripts/patch-webmention-sender-livefetch.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/patch-webmention-sender-livefetch.mjs b/scripts/patch-webmention-sender-livefetch.mjs index 541fad0c..568c937b 100644 --- a/scripts/patch-webmention-sender-livefetch.mjs +++ b/scripts/patch-webmention-sender-livefetch.mjs @@ -81,11 +81,11 @@ const newBlock = ` // [patched:livefetch] Always fetch the live page so t let contentToProcess = ""; try { const _wmInternalBase = (() => { - if (process.env.INTERNAL_FETCH_URL) return process.env.INTERNAL_FETCH_URL.replace(/\\\\/+$/, ""); + if (process.env.INTERNAL_FETCH_URL) return process.env.INTERNAL_FETCH_URL.replace(/\\/+$/, ""); const port = process.env.PORT || "3000"; - return \\\`http://localhost:\\\${port}\\\`; + return \`http://localhost:\${port}\`; })(); - const _wmPublicBase = (process.env.PUBLICATION_URL || process.env.SITE_URL || "").replace(/\\\\/+$/, ""); + const _wmPublicBase = (process.env.PUBLICATION_URL || process.env.SITE_URL || "").replace(/\\/+$/, ""); const fetchUrl = (_wmPublicBase && postUrl.startsWith(_wmPublicBase)) ? _wmInternalBase + postUrl.slice(_wmPublicBase.length) : postUrl;