mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-09-16 07:12:31 +00:00
Update vendor (github.com/mattermost)
This commit is contained in:
36
vendor/github.com/mattermost/platform/model/utils.go
generated
vendored
36
vendor/github.com/mattermost/platform/model/utils.go
generated
vendored
@@ -12,12 +12,14 @@ import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/mail"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"unicode"
|
||||
|
||||
goi18n "github.com/nicksnyder/go-i18n/i18n"
|
||||
"github.com/pborman/uuid"
|
||||
@@ -90,7 +92,7 @@ func AppErrorFromJson(data io.Reader) *AppError {
|
||||
if err == nil {
|
||||
return &er
|
||||
} else {
|
||||
return NewLocAppError("AppErrorFromJson", "model.utils.decode_json.app_error", nil, "body: "+str)
|
||||
return NewAppError("AppErrorFromJson", "model.utils.decode_json.app_error", nil, "body: "+str, http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,18 +108,6 @@ func NewAppError(where string, id string, params map[string]interface{}, details
|
||||
return ap
|
||||
}
|
||||
|
||||
func NewLocAppError(where string, id string, params map[string]interface{}, details string) *AppError {
|
||||
ap := &AppError{}
|
||||
ap.Id = id
|
||||
ap.params = params
|
||||
ap.Message = id
|
||||
ap.Where = where
|
||||
ap.DetailedError = details
|
||||
ap.StatusCode = 500
|
||||
ap.IsOAuth = false
|
||||
return ap
|
||||
}
|
||||
|
||||
var encoding = base32.NewEncoding("ybndrfg8ejkmcpqxot1uwisza345h769")
|
||||
|
||||
// NewId is a globally unique identifier. It is a [A-Z0-9] string 26
|
||||
@@ -283,11 +273,7 @@ func GetServerIpAddress() string {
|
||||
}
|
||||
|
||||
func IsLower(s string) bool {
|
||||
if strings.ToLower(s) == s {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return strings.ToLower(s) == s
|
||||
}
|
||||
|
||||
func IsValidEmail(email string) bool {
|
||||
@@ -492,3 +478,17 @@ func IsValidNumberString(value string) bool {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func IsValidId(value string) bool {
|
||||
if len(value) != 26 {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, r := range value {
|
||||
if !unicode.IsLetter(r) && !unicode.IsNumber(r) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
Reference in New Issue
Block a user