mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-29 07:01:04 +03:00
Bugfix/Allow prefix vars when executing custom function (#3902)
allow prefix vars when executing custom function
This commit is contained in:
@@ -123,6 +123,13 @@ const executeCustomFunction = async (requestBody: any) => {
|
|||||||
const functionInputVariables = Object.fromEntries(
|
const functionInputVariables = Object.fromEntries(
|
||||||
[...(body?.javascriptFunction ?? '').matchAll(/\$([a-zA-Z0-9_]+)/g)].map((g) => [g[1], undefined])
|
[...(body?.javascriptFunction ?? '').matchAll(/\$([a-zA-Z0-9_]+)/g)].map((g) => [g[1], undefined])
|
||||||
)
|
)
|
||||||
|
if (functionInputVariables && Object.keys(functionInputVariables).length) {
|
||||||
|
for (const key in functionInputVariables) {
|
||||||
|
if (key.includes('vars')) {
|
||||||
|
delete functionInputVariables[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
const nodeData = { inputs: { functionInputVariables, ...body } }
|
const nodeData = { inputs: { functionInputVariables, ...body } }
|
||||||
if (Object.prototype.hasOwnProperty.call(appServer.nodesPool.componentNodes, 'customFunction')) {
|
if (Object.prototype.hasOwnProperty.call(appServer.nodesPool.componentNodes, 'customFunction')) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user