Escaping question mark in manticore query to prevent conflict with manticore and knex syntax.

This commit is contained in:
2025-02-09 23:58:29 +01:00
parent 304a9c41bb
commit 42167b062d
4 changed files with 1020 additions and 995 deletions

View File

@@ -4,8 +4,10 @@ export default function escape(string) {
return null;
}
return string
const replaced = string
.replace(/\\/g, String.raw`\\\\`) // using String.raw so we don't have to double up JS and SQL escaping
.replace(/'/g, String.raw`\'`)
.replace(/(["!$()/<@^|~-])/g, String.raw`\\$1`);
.replace(/(["?!$()/<@^|~-])/g, String.raw`\\$1`);
return replaced;
}