From faeb89853b2b7826d30d2001ca4d3544636f5644 Mon Sep 17 00:00:00 2001 From: Nevo David Date: Mon, 18 May 2026 20:32:45 +0700 Subject: [PATCH] feat: threads error --- .../src/integrations/social/threads.provider.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts b/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts index 06fb60a8..0795c29a 100644 --- a/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts +++ b/libraries/nestjs-libraries/src/integrations/social/threads.provider.ts @@ -45,6 +45,12 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider { return { type: 'refresh-token', value: 'Threads access token expired' }; } + if (body.includes('The media could not be fetched from this URI')) { + return { + type: 'bad-body', + value: 'One of the media URLs is invalid or inaccessible, make sure it\'s being uploaded to Postiz first', + }; + } if (body.includes('text must be at most 500 characters')) { return { type: 'bad-body', @@ -189,8 +195,9 @@ export class ThreadsProvider extends SocialAbstract implements SocialProvider { isCarouselItem = false, replyToId?: string ): Promise { - const mediaType = - hasExtension(media.path, 'mp4') ? 'video_url' : 'image_url'; + const mediaType = hasExtension(media.path, 'mp4') + ? 'video_url' + : 'image_url'; const mediaParams = new URLSearchParams({ ...(mediaType === 'video_url' ? { video_url: media.path } : {}), ...(mediaType === 'image_url' ? { image_url: media.path } : {}),