5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 04:40:26 +00:00

Prefer mp4 extension for video attachments (whatsapp) (#1971)

resolves #1967
This commit is contained in:
Joseph Mansy 2023-03-09 12:49:38 -08:00 committed by GitHub
parent ac681687f8
commit a9ccc18d73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -211,7 +211,16 @@ func (b *Bwhatsapp) handleVideoMessage(msg *events.Message) {
fileExt = append(fileExt, ".mp4") fileExt = append(fileExt, ".mp4")
} }
filename := fmt.Sprintf("%v%v", msg.Info.ID, fileExt[0]) // Prefer .mp4 extension, otherwise fallback to first index
fileExtIndex := 0
for i, n := range fileExt {
if ".mp4" == n {
fileExtIndex = i
break
}
}
filename := fmt.Sprintf("%v%v", msg.Info.ID, fileExt[fileExtIndex])
b.Log.Debugf("Trying to download %s with size %#v and type %s", filename, imsg.GetFileLength(), imsg.GetMimetype()) b.Log.Debugf("Trying to download %s with size %#v and type %s", filename, imsg.GetFileLength(), imsg.GetMimetype())