From 2c4f4ca054e52b41706fd2e7f907c0be69451b11 Mon Sep 17 00:00:00 2001 From: Joel Pearson Date: Sat, 21 May 2022 10:04:01 +1000 Subject: [PATCH] fix: escape all quotes instead of the first --- lib/query-filter.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/query-filter.ts b/lib/query-filter.ts index a3f5fd9..722ae58 100644 --- a/lib/query-filter.ts +++ b/lib/query-filter.ts @@ -98,7 +98,7 @@ export const anyOf = (...dsl: Filter[]): Filter => dsl.reduce((p, c) => // this returns true if any are true. export const oneOf = (field: keyof A, ...vals: A[K][]): Filter => anyOf(...vals.map(x => equals(field, x))); -const escapeQuotes = (str: string): string => str.replace("'", "\\'"); +const escapeQuotes = (str: string): string => str.replace(/'/g, "\\'"); const prepareValue = (val: unknown): string => { if (typeof val === "string") { return `'${escapeQuotes(val ?? "")}'`;