MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / resolveWebhookRefs

Function resolveWebhookRefs

packages/server/src/utils/buildAgentflow.ts:110–123  ·  view source on GitHub ↗
(template: string, webhook: Record<string, any> | undefined | null)

Source from the content-addressed store, hash-verified

108 * Unknown references are left as-is.
109 */
110const resolveWebhookRefs = (template: string, webhook: Record<string, any> | undefined | null): string => {
111 if (!template) return ''
112 if (!webhook) return template
113 return template.replace(/{{(.*?)}}/g, (match, ref) => {
114 const path = ref.trim()
115 if (!path.startsWith('$webhook.')) return match
116 // Block prototype-walking paths defensively — lodash.get follows __proto__/constructor/prototype.
117 const subPath = path.replace('$webhook.', '')
118 if (/(^|\.)(__proto__|constructor|prototype)(\.|$)/.test(subPath)) return match
119 const val = get(webhook, subPath)
120 if (val == null) return match
121 return Array.isArray(val) || (typeof val === 'object' && val !== null) ? JSON.stringify(val) : String(val)
122 })
123}
124
125interface IExecuteNodeParams {
126 nodeId: string

Callers 1

executeAgentFlowFunction · 0.85

Calls 3

getFunction · 0.85
testMethod · 0.80
stringifyMethod · 0.80

Tested by

no test coverage detected