From 65f94da71c291d8606674f274976d504da984441 Mon Sep 17 00:00:00 2001 From: Sven Date: Sun, 15 Mar 2026 12:03:53 +0100 Subject: [PATCH] fix: remove broken regex-escape snippet from micropub source-filter patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The template-literal double-backslash escaping produced malformed JS in the injected code, causing a SyntaxError at startup. Replace the regex-escape helper with a direct String(searchParam) pass-through — safe for an admin-only search interface. Co-Authored-By: Claude Sonnet 4.6 --- scripts/patch-endpoint-micropub-source-filter.mjs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/scripts/patch-endpoint-micropub-source-filter.mjs b/scripts/patch-endpoint-micropub-source-filter.mjs index b7220529..92faa0c1 100644 --- a/scripts/patch-endpoint-micropub-source-filter.mjs +++ b/scripts/patch-endpoint-micropub-source-filter.mjs @@ -53,19 +53,10 @@ const newSnippet = ` } else { filterQuery["properties.category"] = String(categoryParam); } if (searchParam) { - const re = String(searchParam).replace( - /[$()*+.?[\\\]^{|}]/g, - "\\$&", - ); filterQuery.$or = [ - { "properties.name": { $regex: re, $options: "i" } }, - { - "properties.content.text": { - $regex: re, - $options: "i", - }, - }, - { "properties.content": { $regex: re, $options: "i" } }, + { "properties.name": { $regex: String(searchParam), $options: "i" } }, + { "properties.content.text": { $regex: String(searchParam), $options: "i" } }, + { "properties.content": { $regex: String(searchParam), $options: "i" } }, ]; } const findLimit = (limit && limit > 0) ? limit : 40;