From affeebf0c28e56a9b125223065ad7d2e6dab43b3 Mon Sep 17 00:00:00 2001 From: guoyangzhen Date: Sat, 14 Mar 2026 16:48:46 +0800 Subject: [PATCH] fix(telegram): allow URL strings in advanced mode media inputs normalizeFileInput only handles file objects, not plain URL strings. Check for string input first before file normalization. Fixes #3220 --- apps/sim/blocks/blocks/telegram.ts | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/apps/sim/blocks/blocks/telegram.ts b/apps/sim/blocks/blocks/telegram.ts index ce4076d3849..8fbdd84ca3a 100644 --- a/apps/sim/blocks/blocks/telegram.ts +++ b/apps/sim/blocks/blocks/telegram.ts @@ -270,6 +270,14 @@ export const TelegramBlock: BlockConfig = { } case 'telegram_send_photo': { // photo is the canonical param for both basic (photoFile) and advanced modes + // In advanced mode, photo can be a plain URL string or file_id + if (typeof params.photo === 'string' && params.photo.trim()) { + return { + ...commonParams, + photo: params.photo.trim(), + caption: params.caption, + } + } const photoSource = normalizeFileInput(params.photo, { single: true, }) @@ -284,6 +292,14 @@ export const TelegramBlock: BlockConfig = { } case 'telegram_send_video': { // video is the canonical param for both basic (videoFile) and advanced modes + // In advanced mode, video can be a plain URL string or file_id + if (typeof params.video === 'string' && params.video.trim()) { + return { + ...commonParams, + video: params.video.trim(), + caption: params.caption, + } + } const videoSource = normalizeFileInput(params.video, { single: true, }) @@ -298,6 +314,14 @@ export const TelegramBlock: BlockConfig = { } case 'telegram_send_audio': { // audio is the canonical param for both basic (audioFile) and advanced modes + // In advanced mode, audio can be a plain URL string or file_id + if (typeof params.audio === 'string' && params.audio.trim()) { + return { + ...commonParams, + audio: params.audio.trim(), + caption: params.caption, + } + } const audioSource = normalizeFileInput(params.audio, { single: true, }) @@ -312,6 +336,14 @@ export const TelegramBlock: BlockConfig = { } case 'telegram_send_animation': { // animation is the canonical param for both basic (animationFile) and advanced modes + // In advanced mode, animation can be a plain URL string or file_id + if (typeof params.animation === 'string' && params.animation.trim()) { + return { + ...commonParams, + animation: params.animation.trim(), + caption: params.caption, + } + } const animationSource = normalizeFileInput(params.animation, { single: true, })