Skip to content

Commit

Permalink
Fix validation
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 committed Dec 5, 2023
1 parent 67be391 commit d11a769
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ func (c Config) Validate() error {
}
}

if strings.HasPrefix(image.Destination, "http://") {
image.Destination = strings.ReplaceAll(image.Destination, "http://", "")
}

dstRef, err := name.ParseReference(image.Destination)
if err != nil {
errs = append(errs, err)
Expand Down
7 changes: 7 additions & 0 deletions api/v1/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ func TestConfig_Validate(t *testing.T) {
},
wantErr: false,
},
{
name: "valid insecure destination",
Images: []ImageMirror{
{Source: "abc", Destination: "http://cde"},
},
wantErr: false,
},
{
name: "image source contains tag",
Images: []ImageMirror{
Expand Down

0 comments on commit d11a769

Please sign in to comment.