Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
Not allowing exclusive whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
izaaklauer committed Aug 8, 2023
1 parent aba8a7d commit 28c6913
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pkg/server/ptypes/project_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/imdario/mergo"
"github.com/mitchellh/go-testing-interface"
"github.com/stretchr/testify/require"
"regexp"

"github.com/hashicorp/waypoint/internal/pkg/validationext"
pb "github.com/hashicorp/waypoint/pkg/server/gen"
Expand Down Expand Up @@ -44,7 +45,10 @@ func ValidateCreateProjectTemplateRequest(req *pb.CreateProjectTemplateRequest)
return append(
// Rules specific to creating a project template
[]*validation.FieldRules{
validation.Field(&req.ProjectTemplate.Name, validation.Required),
validation.Field(&req.ProjectTemplate.Name,
validation.Required,
validation.Match(regexp.MustCompile(`\S+`)), // Disallow only whitespace
),
},

// General project template validation rules
Expand Down
1 change: 0 additions & 1 deletion pkg/server/ptypes/project_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func TestValidateCreateProjectTemplateRequest(t *testing.T) {
},
wantErr: true,
},

}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 28c6913

Please sign in to comment.