5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-22 04:40:26 +00:00

Fix panic in msteams. Fixes #1588 (#1622)

This commit is contained in:
Wim 2021-10-24 22:17:46 +02:00 committed by GitHub
parent 46e4317b77
commit b1f403165d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,8 +19,10 @@ import (
"golang.org/x/oauth2" "golang.org/x/oauth2"
) )
var defaultScopes = []string{"openid", "profile", "offline_access", "Group.Read.All", "Group.ReadWrite.All"} var (
var attachRE = regexp.MustCompile(`<attachment id=.*?attachment>`) defaultScopes = []string{"openid", "profile", "offline_access", "Group.Read.All", "Group.ReadWrite.All"}
attachRE = regexp.MustCompile(`<attachment id=.*?attachment>`)
)
type Bmsteams struct { type Bmsteams struct {
gc *msgraph.GraphServiceRequestBuilder gc *msgraph.GraphServiceRequestBuilder
@ -50,7 +52,7 @@ func (b *Bmsteams) Connect() error {
b.Log.Errorf("Couldn't save sessionfile in %s: %s", tokenCachePath, err) b.Log.Errorf("Couldn't save sessionfile in %s: %s", tokenCachePath, err)
} }
// make file readable only for matterbridge user // make file readable only for matterbridge user
err = os.Chmod(tokenCachePath, 0600) err = os.Chmod(tokenCachePath, 0o600)
if err != nil { if err != nil {
b.Log.Errorf("Couldn't change permissions for %s: %s", tokenCachePath, err) b.Log.Errorf("Couldn't change permissions for %s: %s", tokenCachePath, err)
} }
@ -168,7 +170,7 @@ func (b *Bmsteams) poll(channelName string) error {
} }
// skip non-user message for now. // skip non-user message for now.
if msg.From.User == nil { if msg.From == nil || msg.From.User == nil {
continue continue
} }