mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-17 00:20:51 +00:00
fix: encode the webhook GET payload as UTF-8 so non-ASCII arguments work (#12453)
This commit is contained in:
@@ -120,7 +120,10 @@
|
||||
if (tokenType === 'query') params.push(`token=${token}`)
|
||||
if (chat) params.push(`memory_id=${memory}`)
|
||||
if (callMethod === 'get' || (tokenType === 'query' && requestType === 'sync_sse')) {
|
||||
params.push(`payload=${encodeURIComponent(btoa(JSON.stringify(cleanedRunnableArgs ?? {})))}`)
|
||||
// The server decodes the payload as UTF-8, and btoa only takes Latin-1 characters.
|
||||
const bytes = new TextEncoder().encode(JSON.stringify(cleanedRunnableArgs ?? {}))
|
||||
const binary = Array.from(bytes, (b) => String.fromCharCode(b)).join('')
|
||||
params.push(`payload=${encodeURIComponent(btoa(binary))}`)
|
||||
}
|
||||
return baseWebhookUrl + (params.length ? `?${params.join('&')}` : '')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user