Merge pull request #1344 from alvestassio/fix/multiple-files-sent-via-whatsapp

Adicionando um timestamp ao filename para possibilitar enviar o mesmo arquivo mais de uma vez na mesma conversa.
This commit is contained in:
Davidson Gomes 2025-03-30 12:09:01 -03:00 committed by GitHub
commit 9889035ddc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1332,7 +1332,12 @@ export class BaileysStartupService extends ChannelStartupService {
const { buffer, mediaType, fileName, size } = media;
const mimetype = mimeTypes.lookup(fileName).toString();
const fullName = join(`${this.instance.id}`, received.key.remoteJid, mediaType, fileName);
const fullName = join(
`${this.instance.id}`,
received.key.remoteJid,
mediaType,
`${Date.now()}_${fileName}`,
);
await s3Service.uploadFile(fullName, buffer, size.fileLength?.low, {
'Content-Type': mimetype,
});