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:
parent
6df594f0b4
commit
43259b378c
@ -179,10 +179,14 @@ export class ZinoClient {
|
|||||||
async uploadFile(file, ctx) {
|
async uploadFile(file, ctx) {
|
||||||
const form = new FormData()
|
const form = new FormData()
|
||||||
form.append('file', file)
|
form.append('file', file)
|
||||||
if (ctx.workflowUuid) form.append('workflow_uuid', ctx.workflowUuid)
|
// workflow_uuid is REQUIRED and is fixed for this app, so it is taken from
|
||||||
if (ctx.activityId) form.append('activity_id', ctx.activityId)
|
// config rather than from ctx. Passing it optionally is how the first
|
||||||
if (ctx.fieldId) form.append('field_id', ctx.fieldId)
|
// version shipped: the upload sent activity_id, field_id and instance_id
|
||||||
if (ctx.instanceId) form.append('instance_id', String(ctx.instanceId))
|
// 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 = {}
|
const headers = {}
|
||||||
if (this.token) headers['Authorization'] = `Bearer ${this.token}`
|
if (this.token) headers['Authorization'] = `Bearer ${this.token}`
|
||||||
const res = await fetch(`${this.baseUrl}/app/${APP_ID}/upload`, { method: 'POST', headers, body: form })
|
const res = await fetch(`${this.baseUrl}/app/${APP_ID}/upload`, { method: 'POST', headers, body: form })
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user