mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
fix: increase group name limit to 36 from 32 (#14443)
This commit is contained in:
@ -46,7 +46,7 @@ func init() {
|
||||
valid := NameValid(str)
|
||||
return valid == nil
|
||||
}
|
||||
for _, tag := range []string{"username", "organization_name", "template_name", "group_name", "workspace_name", "oauth2_app_name"} {
|
||||
for _, tag := range []string{"username", "organization_name", "template_name", "workspace_name", "oauth2_app_name"} {
|
||||
err := Validate.RegisterValidation(tag, nameValidator)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -96,6 +96,20 @@ func init() {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
groupNameValidator := func(fl validator.FieldLevel) bool {
|
||||
f := fl.Field().Interface()
|
||||
str, ok := f.(string)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
valid := GroupNameValid(str)
|
||||
return valid == nil
|
||||
}
|
||||
err = Validate.RegisterValidation("group_name", groupNameValidator)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Is404Error returns true if the given error should return a 404 status code.
|
||||
|
Reference in New Issue
Block a user