summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
Diffstat (limited to 'bridge')
-rw-r--r--bridge/whatsappmulti/handlers.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/bridge/whatsappmulti/handlers.go b/bridge/whatsappmulti/handlers.go
index 95fe8232..fd75be09 100644
--- a/bridge/whatsappmulti/handlers.go
+++ b/bridge/whatsappmulti/handlers.go
@@ -211,7 +211,16 @@ func (b *Bwhatsapp) handleVideoMessage(msg *events.Message) {
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())