fix: remove broken regex-escape snippet from micropub source-filter patch

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 <noreply@anthropic.com>
This commit is contained in:
Sven
2026-03-15 12:03:53 +01:00
parent a52d93392f
commit 65f94da71c

View File

@@ -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;