diff --git a/packages/server/src/jsRunner/index.ts b/packages/server/src/jsRunner/index.ts index 477a8c14da..b7e63ce63c 100644 --- a/packages/server/src/jsRunner/index.ts +++ b/packages/server/src/jsRunner/index.ts @@ -6,6 +6,7 @@ import tracer from "dd-trace" import fs from "fs" import url from "url" import crypto from "crypto" +import querystring from "querystring" const helpersSource = fs.readFileSync( `${require.resolve("@budibase/string-templates/index-helpers")}`, @@ -39,6 +40,10 @@ export function init() { resolve: (...params) => urlResolveCb(...params), parse: (...params) => urlParseCb(...params), } + case "querystring": + return { + escape: (...params) => querystringEscapeCb(...params), + } } };` @@ -57,6 +62,14 @@ export function init() { ) ) + global.setSync( + "querystringEscapeCb", + new ivm.Callback( + (...params: Parameters) => + querystring.escape(...params) + ) + ) + const helpersModule = jsIsolate.compileModuleSync( `${injectedRequire};${helpersSource}` )