fix(ui): useApi passes FormData through unaltered so multipart uploads work (IR/GS ingest from UI was JSON-stringifying FormData into '{}')

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-23 23:43:44 -04:00
parent 4da8538054
commit 4ae9815d61
+10 -2
View File
@@ -24,8 +24,16 @@ async function request(method, url, { body, params, signal } = {}) {
const headers = {}
const init = { method, headers, signal }
if (body !== undefined) {
headers['Content-Type'] = 'application/json'
init.body = JSON.stringify(body)
if (body instanceof FormData) {
// Let the browser set Content-Type with the multipart boundary.
// JSON-stringifying FormData produces "{}" and the backend sees
// an empty multipart payload (this broke FC-5 IR/GS ingest from
// the UI for several releases).
init.body = body
} else {
headers['Content-Type'] = 'application/json'
init.body = JSON.stringify(body)
}
}
const r = await fetch(fullUrl, init)