Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit bacff8d40e18e659b78a40d3009ee61ab486dc12 Author: Joseph Crowell <joseph.w.crowell@gmail.com> Date: Sun Dec 14 15:50:30 2025 +0000 make linter happy diff --git a/bridge/matrix/helpers.go b/bridge/matrix/helpers.go index d847bd5..070bb8b 100644 --- a/bridge/matrix/helpers.go +++ b/bridge/matrix/helpers.go @@ -1569 +1569 @@ func (b *Bmatrix) containsAttachment(content event.Content) bool {   }     // Only allow image,video or file msgtypes - if !(content.AsMessage().MsgType == event.MsgImage || - content.AsMessage().MsgType == event.MsgVideo || - content.AsMessage().MsgType == event.MsgFile) { + if content.AsMessage().MsgType != event.MsgImage && + content.AsMessage().MsgType != event.MsgVideo && + content.AsMessage().MsgType != event.MsgFile {   return false   }   diff --git a/bridge/matrix/matrix.go b/bridge/matrix/matrix.go index df4f4c1..922a6ff 100644 --- a/bridge/matrix/matrix.go +++ b/bridge/matrix/matrix.go @@ -7666 +7667 @@ func (b *Bmatrix) handleDownloadFile(rmsg *config.Message, content event.Content   )     rmsg.Extra = make(map[string][]interface{}) +   if url, ok = content.Raw["url"].(string); !ok {   return fmt.Errorf("url isn't a %T", url)   } @@ -77418 +77522 @@ func (b *Bmatrix) handleDownloadFile(rmsg *config.Message, content event.Content   // Also see: https://github.com/matterbridge-org/matterbridge/issues/36   url = strings.ReplaceAll(url, "mxc://", b.GetString("Server")+"/_matrix/client/v1/media/download/")   - if info, ok = content.Raw["info"].(map[string]interface{}); !ok { + if info, ok = content.Raw["info"].(map[string]any); !ok {   return fmt.Errorf("info isn't a %T", info)   } +   if size, ok = info["size"].(float64); !ok {   return fmt.Errorf("size isn't a %T", size)   } +   if name, ok = content.Raw["body"].(string); !ok {   return fmt.Errorf("name isn't a %T", name)   } +   if msgtype, ok = content.Raw["msgtype"].(string); !ok {   return fmt.Errorf("msgtype isn't a %T", msgtype)   } +   if mtype, ok = info["mimetype"].(string); !ok {   return fmt.Errorf("mtype isn't a %T", mtype)   }