Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(cloud): upload inputs as raw bytes, not FormData (WKWebView Load failed)

purple1620f36ccff6
diff --git a/src/api/cloud/jobs.ts b/src/api/cloud/jobs.ts
index e11535f2..196e93f3 100644
--- a/src/api/cloud/jobs.ts
+++ b/src/api/cloud/jobs.ts
@@ -58,12 +58,18 @@ export interface CloudMe {
}
}
-/** Stage a source image or mask; returns the render-inputs storage path. */
+/** Stage a source image or mask; returns the render-inputs storage path.
+ * Sends the raw bytes (role in the query) rather than multipart/form-data:
+ * WKWebView's fetch fails a cross-origin FormData(Blob) body with a bare
+ * "Load failed", which broke every source-needing op (edit/removebg/eraser/
+ * upscale/animate). An ArrayBuffer body serialises fine. */
export async function uploadInput(file: Blob, role: 'source' | 'mask'): Promise<string> {
- const form = new FormData()
- form.append('file', file, role === 'mask' ? 'mask.png' : 'source.png')
- form.append('role', role)
- const res = await cloudFetch('/api/jobs/upload', { method: 'POST', body: form })
+ const body = await file.arrayBuffer()
+ const res = await cloudFetch(`/api/jobs/upload?role=${role}`, {
+ method: 'POST',
+ headers: { 'content-type': 'application/octet-stream' },
+ body,
+ })
const { path } = await jsonOrError<{ path: string }>(res)
return path
}