Skip to content

Commit c4678f3

Browse files
authored
fix: corrige o if que só permitia envio de audio com buffer
1 parent 633ab8b commit c4678f3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,9 +2033,9 @@ export class BaileysStartupService extends ChannelStartupService {
20332033

20342034
if (file?.buffer) {
20352035
mediaData.audio = file.buffer.toString('base64');
2036-
} else {
2037-
console.error('File or buffer is undefined.');
2038-
throw new Error('File or buffer is undefined.');
2036+
} else if (!isURL(data.audio)) {
2037+
console.error('Invalid file or audio source');
2038+
throw new BadRequestException('File buffer or URL audio is required');
20392039
}
20402040

20412041
if (!data?.encoding && data?.encoding !== false) {

0 commit comments

Comments
 (0)