core: escape paranthesis in notes search query

Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com>
This commit is contained in:
01zulfi
2025-10-27 13:00:21 +05:00
parent 36c8b8cc25
commit fca61afd7c
2 changed files with 17 additions and 1 deletions

View File

@@ -1154,7 +1154,8 @@ function textContainsTokens(text: string, tokens: QueryTokens) {
const lowerCasedText = text.toLowerCase();
const createTagPattern = (token: string) => {
return `<${MATCH_TAG_NAME}\\s+id="(.+?)">${token}<\\/${MATCH_TAG_NAME}>`;
const escapedToken = token.replace(/[()]/g, "\\$&");
return `<${MATCH_TAG_NAME}\\s+id="(.+?)">${escapedToken}<\\/${MATCH_TAG_NAME}>`;
};
if (