From 4fcad8e04befeec2c7e468b36500fa33eb22af51 Mon Sep 17 00:00:00 2001 From: Avinash Reddy Date: Wed, 26 May 2021 03:36:45 +0530 Subject: [PATCH] Make DocumentMessage handler use FileName attribute (whatsapp) (#1488) * [whatsapp] make DocumentMessage handler use FileName attribute. referenced: https://github.com/Rhymen/go-whatsapp/blob/master/message.go#L582 * fix lint --- bridge/whatsapp/handlers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bridge/whatsapp/handlers.go b/bridge/whatsapp/handlers.go index 04e44693..1be9b5e3 100644 --- a/bridge/whatsapp/handlers.go +++ b/bridge/whatsapp/handlers.go @@ -359,9 +359,9 @@ func (b *Bwhatsapp) HandleDocumentMessage(message whatsapp.DocumentMessage) { return } - filename := fmt.Sprintf("%v%v", message.Info.Id, fileExt[0]) + filename := fmt.Sprintf("%v", message.FileName) - b.Log.Debugf("Trying to download %s with type %s", filename, message.Type) + b.Log.Debugf("Trying to download %s with extension %s and type %s", filename, fileExt, message.Type) data, err := message.Download() if err != nil {