Fix url.escape
This commit is contained in:
parent
1b88700d02
commit
d1cf13707d
|
@ -6,6 +6,7 @@ import tracer from "dd-trace"
|
||||||
import fs from "fs"
|
import fs from "fs"
|
||||||
import url from "url"
|
import url from "url"
|
||||||
import crypto from "crypto"
|
import crypto from "crypto"
|
||||||
|
import querystring from "querystring"
|
||||||
|
|
||||||
const helpersSource = fs.readFileSync(
|
const helpersSource = fs.readFileSync(
|
||||||
`${require.resolve("@budibase/string-templates/index-helpers")}`,
|
`${require.resolve("@budibase/string-templates/index-helpers")}`,
|
||||||
|
@ -39,6 +40,10 @@ export function init() {
|
||||||
resolve: (...params) => urlResolveCb(...params),
|
resolve: (...params) => urlResolveCb(...params),
|
||||||
parse: (...params) => urlParseCb(...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<typeof querystring.escape>) =>
|
||||||
|
querystring.escape(...params)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
const helpersModule = jsIsolate.compileModuleSync(
|
const helpersModule = jsIsolate.compileModuleSync(
|
||||||
`${injectedRequire};${helpersSource}`
|
`${injectedRequire};${helpersSource}`
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue