Skip to content
Merged
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
3 changes: 3 additions & 0 deletions pkg/registries/registries.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ func EditRegistriesConfig(config *sysregistriesv2.V2RegistriesConf, insecureScop
// This function can be used to validate the registries entries prior to calling EditRegistriesConfig
// in the MCO or builds code
func IsValidRegistriesConfScope(scope string) bool {
if scope == "" {
return false
}
// If scope does not contain the wildcard character, we will assume it is a regular registry entry, which is valid
if !strings.Contains(scope, "*") {
return true
Expand Down
1 change: 1 addition & 0 deletions pkg/registries/registries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func TestIsValidRegistriesConfScope(t *testing.T) {
{"*example.com", false},
{"*/example.com", false},
{"*.*example.com", false},
{"", false}, // Invalid empty string entry
} {
t.Run(fmt.Sprintf("%#v", tt.scope), func(t *testing.T) {
res := IsValidRegistriesConfScope(tt.scope)
Expand Down