Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/utils/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ type ErrInvalidNamespace error
// (e.g. 'my-name', or 'abc-1', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?')
func ValidateFunctionName(name string) error {

if strings.Contains(name, "--") {
return ErrInvalidFunctionName(fmt.Errorf("function name '%v' cannot contain consecutive hyphens", name))
}

if errs := validation.IsDNS1035Label(name); len(errs) > 0 {
// In case of invalid name the error is this:
// "a DNS-1035 label must consist of lower case alphanumeric characters or '-',
Expand Down
1 change: 1 addition & 0 deletions pkg/utils/names_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ func TestValidateFunctionName(t *testing.T) {
{"Example", false},
{"EXAMPLE", false},
{"42", false},
{"test--func", false},
}

for _, c := range cases {
Expand Down
Loading