fix: correction sending s3/minio media to chatwoot and typebot

This commit is contained in:
Davidson Gomes 2023-12-14 11:50:05 -03:00
parent a44646161b
commit 20fb66e2f7
3 changed files with 9 additions and 2 deletions

View File

@ -5,6 +5,7 @@
* Fixed Lid Messages
* Fixed sending variables to typebot
* Fixed sending variables from typebot
* Correction sending s3/minio media to chatwoot and typebot
# 1.6.0 (2023-12-12 17:24)

View File

@ -920,7 +920,11 @@ export class ChatwootService {
const fileName = decodeURIComponent(parts[parts.length - 1]);
this.logger.verbose('file name: ' + fileName);
const mimeType = mimeTypes.lookup(fileName).toString();
const response = await axios.get(media, {
responseType: 'arraybuffer',
});
const mimeType = response.headers['content-type'];
this.logger.verbose('mime type: ' + mimeType);
let type = 'document';

View File

@ -2689,7 +2689,9 @@ export class WAStartupService {
mimetype = mediaMessage.mimetype;
} else {
if (isURL(mediaMessage.media)) {
mimetype = getMIMEType(mediaMessage.media);
const response = await axios.get(mediaMessage.media, { responseType: 'arraybuffer' });
mimetype = response.headers['content-type'];
} else {
mimetype = getMIMEType(mediaMessage.fileName);
}