From 3d2ba858bb324a1ae8fde30b1e4d66b3db3e433e Mon Sep 17 00:00:00 2001 From: billisdead Date: Thu, 21 May 2026 22:51:59 +0200 Subject: [PATCH] fix: omit empty image array and bogus id from post value items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sending image:[] causes a 400 from the Postiz API — only include the image field when there is actual media to attach. Also remove the id:"" field which was never valid. Co-Authored-By: Claude Sonnet 4.6 --- artifacts/postiz-mobile/app/(tabs)/compose.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/artifacts/postiz-mobile/app/(tabs)/compose.tsx b/artifacts/postiz-mobile/app/(tabs)/compose.tsx index 67cc6b5..9c430e9 100644 --- a/artifacts/postiz-mobile/app/(tabs)/compose.tsx +++ b/artifacts/postiz-mobile/app/(tabs)/compose.tsx @@ -143,10 +143,16 @@ export default function ComposeScreen() { date: postNow ? new Date().toISOString() : scheduleDate.toISOString(), shortLink: false, tags: [] as string[], - posts: selectedChannels.map((integrationId) => ({ - integration: { id: integrationId }, - value: [{ content: content.trim(), id: "", image: media }], - })), + posts: selectedChannels.map((integrationId) => { + const valueItem: { content: string; image?: Array<{ id: string; path: string }> } = { + content: content.trim(), + }; + if (media.length > 0) valueItem.image = media; + return { + integration: { id: integrationId }, + value: [valueItem], + }; + }), }; const body = JSON.stringify(payload);