Skip to content

Commit

Permalink
For OCI, convert + to _ before pull, and + to _ before push
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Rigby <scott@r6by.com>
  • Loading branch information
scottrigby committed Jan 5, 2022
1 parent b8d3535 commit 472eb6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/experimental/pusher/ocipusher.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ func (pusher *OCIPusher) push(chartRef, href string) error {
path.Join(strings.TrimPrefix(href, fmt.Sprintf("%s://", registry.OCIScheme)), meta.Metadata.Name),
meta.Metadata.Version)

// Convert plus (+) to underscore (_) before push, so OCI doesn't choke
// This must remain right above client.Push()
// See https://github.com/helm/helm/issues/10166
ref = strings.ReplaceAll(ref, "+", "_")

_, err = client.Push(chartBytes, ref, pushOpts...)
return err
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/getter/ocigetter.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ func (g *OCIGetter) get(href string) (*bytes.Buffer, error) {
ref = fmt.Sprintf("%s:%s", ref, version)
}

// Convert plus (+) to underscore (_) in request string before pull
// This must remain right above client.Pull()
// See https://github.com/helm/helm/issues/10166
ref = strings.ReplaceAll(ref, "+", "_")

result, err := client.Pull(ref, pullOpts...)
if err != nil {
return nil, err
Expand Down

0 comments on commit 472eb6f

Please sign in to comment.