Skip to content

Commit

Permalink
Bugfix/Allow prefix vars when executing custom function (#3902)
Browse files Browse the repository at this point in the history
allow prefix vars when executing custom function
  • Loading branch information
HenryHengZJ authored Jan 21, 2025
1 parent 4aa97b0 commit 5cc0e98
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/server/src/services/nodes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ const executeCustomFunction = async (requestBody: any) => {
const functionInputVariables = Object.fromEntries(
[...(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 } }
if (Object.prototype.hasOwnProperty.call(appServer.nodesPool.componentNodes, 'customFunction')) {
try {
Expand Down

0 comments on commit 5cc0e98

Please sign in to comment.