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

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

2003
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -57,8 +57,8 @@
"template-format": "^1.2.5",
"unprint": "^0.14.1",
"video.js": "^8.10.0",
"vike": "^0.4.150",
"vite": "^4.5.1",
"vike": "^0.4.220",
"vite": "^6.1.0",
"vue": "^3.3.10",
"vue-virtual-scroller": "^2.0.0-beta.8",
"winston": "^3.11.0",

2
static

@ -1 +1 @@
Subproject commit 3d26382892215138f86fc2efc658d12ae115f5ff
Subproject commit 04c9d2175cf66bf3e286da6ffded79848a8d2488

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