Fix crash on encountering VideoMessage (whatsapp) (#1483)

* [whatsapp] fix crash on encountering VideoMessage

* Update handlers.go

* gofmt
This commit is contained in:
Avinash Reddy 2021-05-24 00:51:30 +05:30 committed by GitHub
parent b9fb361959
commit ec6ae343dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -237,6 +237,10 @@ func (b *Bwhatsapp) HandleVideoMessage(message whatsapp.VideoMessage) {
return return
} }
if len(fileExt) == 0 {
fileExt = append(fileExt, ".mp4")
}
filename := fmt.Sprintf("%v%v", message.Info.Id, fileExt[0]) filename := fmt.Sprintf("%v%v", message.Info.Id, fileExt[0])
b.Log.Debugf("Trying to download %s with size %#v and type %s", filename, message.Length, message.Type) b.Log.Debugf("Trying to download %s with size %#v and type %s", filename, message.Length, message.Type)