From 533332a6ae0673cc590d6501618adce92b684707 Mon Sep 17 00:00:00 2001 From: adbenitez Date: Mon, 27 Feb 2023 02:18:06 -0500 Subject: [PATCH] try to support Extra attachments from API --- gateway/handlers.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gateway/handlers.go b/gateway/handlers.go index 44cefe45..bd8561f7 100644 --- a/gateway/handlers.go +++ b/gateway/handlers.go @@ -15,6 +15,7 @@ import ( "github.com/42wim/matterbridge/bridge" "github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/gateway/bridgemap" + "github.com/mitchellh/mapstructure" ) // handleEventFailure handles failures and reconnects bridges. @@ -84,7 +85,10 @@ func (gw *Gateway) handleFiles(msg *config.Message) { } for i, f := range msg.Extra["file"] { - fi := f.(config.FileInfo) + fi, ok := f.(config.FileInfo) + if ok { + mapstructure.Decode(f.(map[string]interface{}), &fi) + } ext := filepath.Ext(fi.Name) fi.Name = fi.Name[0 : len(fi.Name)-len(ext)] fi.Name = reg.ReplaceAllString(fi.Name, "_")