Skip to content

Commit 9889035

Browse files
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.
2 parents 07ce09d + bf59ff1 commit 9889035

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,12 @@ export class BaileysStartupService extends ChannelStartupService {
13321332

13331333
const { buffer, mediaType, fileName, size } = media;
13341334
const mimetype = mimeTypes.lookup(fileName).toString();
1335-
const fullName = join(`${this.instance.id}`, received.key.remoteJid, mediaType, fileName);
1335+
const fullName = join(
1336+
`${this.instance.id}`,
1337+
received.key.remoteJid,
1338+
mediaType,
1339+
`${Date.now()}_${fileName}`,
1340+
);
13361341
await s3Service.uploadFile(fullName, buffer, size.fileLength?.low, {
13371342
'Content-Type': mimetype,
13381343
});

0 commit comments

Comments
 (0)