Skip to content

Commit 20fb66e

Browse files
committed
fix: correction sending s3/minio media to chatwoot and typebot
1 parent a446461 commit 20fb66e

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Fixed Lid Messages
66
* Fixed sending variables to typebot
77
* Fixed sending variables from typebot
8+
* Correction sending s3/minio media to chatwoot and typebot
89

910
# 1.6.0 (2023-12-12 17:24)
1011

src/whatsapp/services/chatwoot.service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,11 @@ export class ChatwootService {
920920
const fileName = decodeURIComponent(parts[parts.length - 1]);
921921
this.logger.verbose('file name: ' + fileName);
922922

923-
const mimeType = mimeTypes.lookup(fileName).toString();
923+
const response = await axios.get(media, {
924+
responseType: 'arraybuffer',
925+
});
926+
927+
const mimeType = response.headers['content-type'];
924928
this.logger.verbose('mime type: ' + mimeType);
925929

926930
let type = 'document';

src/whatsapp/services/whatsapp.service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2689,7 +2689,9 @@ export class WAStartupService {
26892689
mimetype = mediaMessage.mimetype;
26902690
} else {
26912691
if (isURL(mediaMessage.media)) {
2692-
mimetype = getMIMEType(mediaMessage.media);
2692+
const response = await axios.get(mediaMessage.media, { responseType: 'arraybuffer' });
2693+
2694+
mimetype = response.headers['content-type'];
26932695
} else {
26942696
mimetype = getMIMEType(mediaMessage.fileName);
26952697
}

0 commit comments

Comments
 (0)