Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: escape special characters in SQL search query (#7418)

luis-41143356e5b6a46
diff --git a/packages/core/src/utils/query-transformer.ts b/packages/core/src/utils/query-transformer.ts
index 653bc726b..1be3b0bb9 100644
--- a/packages/core/src/utils/query-transformer.ts
+++ b/packages/core/src/utils/query-transformer.ts
@@ -39,11 +39,7 @@ function escapeSQLString(str: string): string {
return `"${innerStr}"`;
}
- const maybeColspec =
- str.includes(":") ||
- str.includes(">") ||
- str.includes("<") ||
- str.includes("-");
+ const maybeColspec = /[:<>./\\()$&=#!\-\+\~§@^?,;'"\[\]{}|]/.test(str);
const isWildcard =
str.startsWith("*") ||
str.endsWith("*") ||