Add some more escapes to the query sanitizer

Signed-off-by: Tom Hughes <tom@compton.nu>
This commit is contained in:
Tom Hughes 2023-07-04 19:08:35 +01:00
parent d01184f28d
commit 099d3ddb6f
1 changed files with 5 additions and 0 deletions

View File

@ -50,7 +50,12 @@ func sanitizeQuery(q string) string {
q = strings.Join(strings.Fields(q), " ") q = strings.Join(strings.Fields(q), " ")
q = strings.Replace(q, "(", "\\(", -1) q = strings.Replace(q, "(", "\\(", -1)
q = strings.Replace(q, ")", "\\)", -1) q = strings.Replace(q, ")", "\\)", -1)
q = strings.Replace(q, "[", "\\[", -1)
q = strings.Replace(q, "]", "\\]", -1)
q = strings.Replace(q, "{", "\\{", -1)
q = strings.Replace(q, "}", "\\}", -1)
q = strings.Replace(q, "*", "\\*", -1) q = strings.Replace(q, "*", "\\*", -1)
q = strings.Replace(q, "^", "\\^", -1)
q = strings.Replace(q, "$", "\\$", -1) q = strings.Replace(q, "$", "\\$", -1)
return q return q
} }