mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
id: fix ServerNameRegex not matching port correctly (#392)
Some checks failed
Some checks failed
fixes #391
This commit is contained in:
parent
324be4ecb9
commit
3a135b6b15
1 changed files with 1 additions and 1 deletions
|
|
@ -25,7 +25,7 @@ type ParsedServerName struct {
|
|||
Port int
|
||||
}
|
||||
|
||||
var ServerNameRegex = regexp.MustCompile(`^(?:\[([0-9A-Fa-f:.]{2,45})]|(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|([0-9A-Za-z.-]{1,255}))(\d{1,5})?$`)
|
||||
var ServerNameRegex = regexp.MustCompile(`^(?:\[([0-9A-Fa-f:.]{2,45})]|(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|([0-9A-Za-z.-]{1,255}))(?::(\d{1,5}))?$`)
|
||||
|
||||
func ValidateServerName(serverName string) bool {
|
||||
return len(serverName) <= 255 && len(serverName) > 0 && ServerNameRegex.MatchString(serverName)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue