fix(upload): always send workflow_uuid

/upload requires it and it is fixed for this app, but the client only
appended it when ctx happened to carry it — and FileField passes only
activity, field and instance. Every upload came back 400 with
"Missing required params: workflow_uuid".

Taken from config now, so it cannot be forgotten by a caller.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yashas 2026-08-25 13:46:51 +05:30
parent 6df594f0b4
commit 43259b378c

View File

@ -179,10 +179,14 @@ export class ZinoClient {
async uploadFile(file, ctx) {
const form = new FormData()
form.append('file', file)
if (ctx.workflowUuid) form.append('workflow_uuid', ctx.workflowUuid)
if (ctx.activityId) form.append('activity_id', ctx.activityId)
if (ctx.fieldId) form.append('field_id', ctx.fieldId)
if (ctx.instanceId) form.append('instance_id', String(ctx.instanceId))
// workflow_uuid is REQUIRED and is fixed for this app, so it is taken from
// config rather than from ctx. Passing it optionally is how the first
// version shipped: the upload sent activity_id, field_id and instance_id
// and got back `Missing required params: workflow_uuid`.
form.append('workflow_uuid', WORKFLOW)
if (ctx.activityId) form.append('activity_id', ctx.activityId)
if (ctx.fieldId) form.append('field_id', ctx.fieldId)
if (ctx.instanceId) form.append('instance_id', String(ctx.instanceId))
const headers = {}
if (this.token) headers['Authorization'] = `Bearer ${this.token}`
const res = await fetch(`${this.baseUrl}/app/${APP_ID}/upload`, { method: 'POST', headers, body: form })