mirror of
https://github.com/joohoi/acme-dns.git
synced 2025-07-07 00:39:05 +07:00
Fix reserved name
This commit is contained in:
6
util.go
6
util.go
@ -5,7 +5,7 @@ import (
|
|||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NormalizeString(s string, len int) string {
|
func NormalizeString(s string, length int) string {
|
||||||
var ret string
|
var ret string
|
||||||
re, err := regexp.Compile("[^A-Za-z\\-0-9]+")
|
re, err := regexp.Compile("[^A-Za-z\\-0-9]+")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -13,8 +13,8 @@ func NormalizeString(s string, len int) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
ret = re.ReplaceAllString(s, "")
|
ret = re.ReplaceAllString(s, "")
|
||||||
if utf8.RuneCountInString(ret) > len {
|
if utf8.RuneCountInString(ret) > length {
|
||||||
ret = ret[0:len]
|
ret = ret[0:length]
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user