Skip to content

Commit

Permalink
working code waiting for testing
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoxuan Wang <[email protected]>
  • Loading branch information
Xiaoxuan Wang committed Sep 4, 2024
1 parent 4c88cb8 commit e1b3dec
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cmd/oras/internal/option/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@ func (opts *Target) Parse(cmd *cobra.Command) error {
}
} else {
opts.Reference = ref.Reference

raw := opts.RawReference
var path string
if idx := strings.LastIndex(raw, "@"); idx != -1 {
// `digest` found
path = raw[:idx]
} else {
// find `tag`
var err error
path, _, err = fileref.Parse(raw, "")
if err != nil {
return errors.Join(err, errdef.ErrInvalidReference)

Check warning on line 127 in cmd/oras/internal/option/target.go

View check run for this annotation

Codecov / codecov/patch

cmd/oras/internal/option/target.go#L127

Added line #L127 was not covered by tests
}
}
opts.Path = path
}
return opts.Remote.Parse(cmd)
}
Expand Down

0 comments on commit e1b3dec

Please sign in to comment.