Skip to content

Commit

Permalink
fix(oci): Trim OCI prefix when using output argument
Browse files Browse the repository at this point in the history
Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
  • Loading branch information
craciunoiuc committed Sep 8, 2023
1 parent c29786f commit 084c1cd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions oci/pack.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ func NewPackageFromTarget(ctx context.Context, targ target.Target, opts ...packm
}

if popts.Output() != "" {
ocipack.ref, err = name.ParseReference(popts.Output(),
output := popts.Output()
if strings.HasPrefix(popts.Output(), "oci://") {
output = strings.TrimPrefix(popts.Output(), "oci://")
}

ocipack.ref, err = name.ParseReference(
output,
name.WithDefaultRegistry(DefaultRegistry),
)
} else {
Expand Down Expand Up @@ -311,7 +317,13 @@ func NewPackageFromTargets(ctx context.Context, targ []target.Target, opts ...pa
}

if popts.Output() != "" {
ref, err = name.ParseReference(popts.Output(),
output := popts.Output()
if strings.HasPrefix(popts.Output(), "oci://") {
output = strings.TrimPrefix(popts.Output(), "oci://")
}

ref, err = name.ParseReference(
output,
name.WithDefaultRegistry(DefaultRegistry),
)
} else if len(targ) == 1 {
Expand Down

0 comments on commit 084c1cd

Please sign in to comment.