Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/core/engines/noweb/session.noweb.core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2848,9 +2848,12 @@ export class NOWEBEngineMediaProcessor implements IMediaEngineProcessor<any> {
content.url = null;
}

return (await downloadMediaMessage(
// Use 'stream' mode instead of 'buffer' to fix 0-byte audio files
// 'buffer' mode silently returns empty buffer for audio/voice messages
// See: https://github.com/devlikeapro/waha/issues/1996
const stream = await downloadMediaMessage(
message,
'buffer',
'stream',
{},
{
logger: this.logger,
Expand All @@ -2859,7 +2862,12 @@ export class NOWEBEngineMediaProcessor implements IMediaEngineProcessor<any> {
).finally(() => {
// Set url back in case we removed it
content.url = url;
})) as Buffer;
});
const chunks: Buffer[] = [];
for await (const chunk of stream) {
chunks.push(chunk);
}
return Buffer.concat(chunks);
}

getFilename(message: any): string | null {
Expand Down