4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-07-05 20:44:04 +00:00

Update dependencies (#1841)

This commit is contained in:
Wim
2022-06-11 23:07:42 +02:00
committed by GitHub
parent 3819062574
commit 8751fb4bb1
188 changed files with 5608 additions and 1334 deletions

View File

@ -33,6 +33,7 @@ const (
UppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
NUMBERS = "0123456789"
SYMBOLS = " !\"\\#$%&'()*+,-./:;<=>?@[]^_`|~"
BinaryParamKey = "MM_BINARY_PARAMETERS"
)
type StringInterface map[string]interface{}
@ -124,12 +125,19 @@ func (m *StringMap) Scan(value interface{}) error {
// Value converts StringMap to database value
func (m StringMap) Value() (driver.Value, error) {
j, err := json.Marshal(m)
ok := m[BinaryParamKey]
delete(m, BinaryParamKey)
buf, err := json.Marshal(m)
if err != nil {
return nil, err
}
// non utf8 characters are not supported https://mattermost.atlassian.net/browse/MM-41066
return string(j), err
if ok == "true" {
return append([]byte{0x01}, buf...), nil
} else if ok == "false" {
return buf, nil
}
// Key wasn't found. We fall back to the default case.
return string(buf), nil
}
func (StringMap) ImplementsGraphQLType(name string) bool {
@ -502,21 +510,13 @@ var reservedName = []string{
}
func IsValidChannelIdentifier(s string) bool {
if !IsValidAlphaNumHyphenUnderscore(s, true) {
return false
}
if len(s) < ChannelNameMinLength {
return false
}
return true
return validSimpleAlphaNum.MatchString(s) && len(s) >= ChannelNameMinLength
}
var (
validAlphaNum = regexp.MustCompile(`^[a-z0-9]+([a-z\-0-9]+|(__)?)[a-z0-9]+$`)
validAlphaNumHyphenUnderscore = regexp.MustCompile(`^[a-z0-9]+([a-z\-\_0-9]+|(__)?)[a-z0-9]+$`)
validSimpleAlphaNum = regexp.MustCompile(`^[a-z0-9]+([a-z\-\_0-9]+|(__)?)[a-z0-9]*$`)
validSimpleAlphaNumHyphenUnderscore = regexp.MustCompile(`^[a-zA-Z0-9\-_]+$`)
validSimpleAlphaNumHyphenUnderscorePlus = regexp.MustCompile(`^[a-zA-Z0-9+_-]+$`)
)