Thumbnail

rani/matterbridge.git

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

commit ce581517f37a07ad790a4817409fbe1c53cffc82 Author: Wim <wim@42.be> Date: Sun Oct 24 22:17:46 2021 +0000 Fix panic in msteams. Fixes #1588 (#1622) diff --git a/bridge/msteams/msteams.go b/bridge/msteams/msteams.go index 87a15a7..27d7bee 100644 --- a/bridge/msteams/msteams.go +++ b/bridge/msteams/msteams.go @@ -198 +1910 @@ import (   "golang.org/x/oauth2"  )   -var defaultScopes = []string{"openid", "profile", "offline_access", "Group.Read.All", "Group.ReadWrite.All"} -var attachRE = regexp.MustCompile(`<attachment id=.*?attachment>`) +var ( + defaultScopes = []string{"openid", "profile", "offline_access", "Group.Read.All", "Group.ReadWrite.All"} + attachRE = regexp.MustCompile(`<attachment id=.*?attachment>`) +)    type Bmsteams struct {   gc *msgraph.GraphServiceRequestBuilder @@ -507 +527 @@ func (b *Bmsteams) Connect() error {   b.Log.Errorf("Couldn't save sessionfile in %s: %s", tokenCachePath, err)   }   // make file readable only for matterbridge user - err = os.Chmod(tokenCachePath, 0600) + err = os.Chmod(tokenCachePath, 0o600)   if err != nil {   b.Log.Errorf("Couldn't change permissions for %s: %s", tokenCachePath, err)   } @@ -1687 +1707 @@ func (b *Bmsteams) poll(channelName string) error {   }     // skip non-user message for now. - if msg.From.User == nil { + if msg.From == nil || msg.From.User == nil {   continue   }