From c4678f39a2d5bb7fbd29e814ced31c5fc1ad2fc6 Mon Sep 17 00:00:00 2001 From: Felipe Medeiros Date: Mon, 11 Nov 2024 13:12:09 -0300 Subject: [PATCH] =?UTF-8?q?fix:=20corrige=20o=20if=20que=20s=C3=B3=20permi?= =?UTF-8?q?tia=20envio=20de=20audio=20com=20buffer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../channel/whatsapp/whatsapp.baileys.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts index 0986067c..bd3cb7e7 100644 --- a/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts +++ b/src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts @@ -2033,9 +2033,9 @@ export class BaileysStartupService extends ChannelStartupService { if (file?.buffer) { mediaData.audio = file.buffer.toString('base64'); - } else { - console.error('File or buffer is undefined.'); - throw new Error('File or buffer is undefined.'); + } else if (!isURL(data.audio)) { + console.error('Invalid file or audio source'); + throw new BadRequestException('File buffer or URL audio is required'); } if (!data?.encoding && data?.encoding !== false) {