UBERF-9496 (#8061)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev
2025-02-20 22:28:59 +07:00
committed by GitHub
parent 9e202352eb
commit 3cc324da77
8 changed files with 114 additions and 131 deletions
+5 -2
View File
@@ -127,6 +127,9 @@ export async function getSinceRaw (
export function gqlp (params: Record<string, string | number | string[] | undefined>): string {
let result = ''
let first = true
function escape (str: string): string {
return str.replace(/"/g, '\\"')
}
for (const [k, v] of Object.entries(params)) {
if (v !== undefined) {
if (!first) {
@@ -136,9 +139,9 @@ export function gqlp (params: Record<string, string | number | string[] | undefi
if (typeof v === 'number') {
result += `${k}: ${v}`
} else if (Array.isArray(v)) {
result += `${k}: [${v.map((it) => `"${it}"`).join(', ')}]`
result += `${k}: [${v.map((it) => `"${escape(it)}"`).join(', ')}]`
} else {
result += `${k}: "${v}"`
result += `${k}: "${escape(v)}"`
}
}
}