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:
26
vendor/github.com/mattermost/mattermost-server/v6/model/utils.go
generated
vendored
26
vendor/github.com/mattermost/mattermost-server/v6/model/utils.go
generated
vendored
@ -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+_-]+$`)
|
||||
)
|
||||
|
Reference in New Issue
Block a user