summaryrefslogtreecommitdiffstats
path: root/model/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/utils.go')
-rw-r--r--model/utils.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/model/utils.go b/model/utils.go
index 465901a09..093a54e38 100644
--- a/model/utils.go
+++ b/model/utils.go
@@ -148,7 +148,7 @@ func IsValidEmail(email string) bool {
return false
}
-var reservedDomains = []string{
+var reservedName = []string{
"www",
"web",
"admin",
@@ -168,10 +168,10 @@ var reservedDomains = []string{
"api",
}
-func IsReservedDomain(s string) bool {
+func IsReservedTeamName(s string) bool {
s = strings.ToLower(s)
- for _, value := range reservedDomains {
+ for _, value := range reservedName {
if strings.Index(s, value) == 0 {
return true
}
@@ -180,7 +180,7 @@ func IsReservedDomain(s string) bool {
return false
}
-func IsValidDomain(s string) bool {
+func IsValidTeamName(s string) bool {
if !IsValidAlphaNum(s) {
return false
@@ -319,6 +319,6 @@ func ClearMentionTags(post string) string {
}
var UrlRegex = regexp.MustCompile(`^((?:[a-z]+:\/\/)?(?:(?:[a-z0-9\-]+\.)+(?:[a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|local|internal))(:[0-9]{1,5})?(?:\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(?:\?[a-z0-9+_~\-\.%=&]*)?)?(?:#[a-zA-Z0-9!$&'()*+.=-_~:@/?]*)?)(?:\s+|$)$`)
-var PartialUrlRegex = regexp.MustCompile(`/api/v1/files/(get|get_image)/([A-Za-z0-9]{26})/([A-Za-z0-9]{26})/(([A-Za-z0-9]+/)?.+\.[A-Za-z0-9]{3,})`)
+var PartialUrlRegex = regexp.MustCompile(`/([A-Za-z0-9]{26})/([A-Za-z0-9]{26})/((?:[A-Za-z0-9]{26})?.+\.[A-Za-z0-9]{3,})`)
var SplitRunes = map[rune]bool{',': true, ' ': true, '.': true, '!': true, '?': true, ':': true, ';': true, '\n': true, '<': true, '>': true, '(': true, ')': true, '{': true, '}': true, '[': true, ']': true, '+': true, '/': true, '\\': true}