Skip to content

Commit

Permalink
bugfix: fix invalid escape character usage
Browse files Browse the repository at this point in the history
Thanks to Long0x0, 44f90e6#r138328406
  • Loading branch information
cxz66666 committed Feb 6, 2024
1 parent 7105140 commit bc0ea9a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions init.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func parseTOMLConfig(configFile string, conf *configs.Config) error {
}

for _, singleCustomProxyDomain := range confTOML.CustomProxyDomain {
var domainRegex = regexp.MustCompile(`^[a-zA-Zd-]+(.[a-zA-Zd-]+)*.[a-zA-Z]{2,}$`)
var domainRegex = regexp.MustCompile(`^[a-zA-Zd-]+(\.[a-zA-Zd-]+)*\.[a-zA-Z]{2,}$`)
if !domainRegex.MatchString(singleCustomProxyDomain) {
fmt.Printf("ZJU Connect: %s is not a valid domain\n", singleCustomProxyDomain)
return errors.New(fmt.Sprintf("ZJU Connect: %s is not a valid domain", singleCustomProxyDomain))
Expand Down Expand Up @@ -201,7 +201,7 @@ func init() {
if customProxyDomain != "" {
domainList := strings.Split(customProxyDomain, ",")
for _, domain := range domainList {
var domainRegex = regexp.MustCompile(`^[a-zA-Zd-]+(.[a-zA-Zd-]+)*.[a-zA-Z]{2,}$`)
var domainRegex = regexp.MustCompile(`^[a-zA-Zd-]+(\.[a-zA-Zd-]+)*\.[a-zA-Z]{2,}$`)
if !domainRegex.MatchString(domain) {
fmt.Printf("ZJU Connect: %s is not a valid domain\n", domain)
os.Exit(1)
Expand Down

0 comments on commit bc0ea9a

Please sign in to comment.