Skip to content

Commit

Permalink
Merge branch 'main' into classic-snap
Browse files Browse the repository at this point in the history
  • Loading branch information
qweeah authored Jan 29, 2024
2 parents e258bc7 + 06097c0 commit 899f258
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cmd/oras/internal/option/packer.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,10 @@ func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string
}
if opts.AnnotationFilePath != "" {
if err = decodeJSON(opts.AnnotationFilePath, &annotations); err != nil {
errStr := err.Error()
docLink := " Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations."
if !strings.HasSuffix(errStr, ".") {
docLink = "." + docLink
return nil, &oerrors.Error{
Err: fmt.Errorf(`invalid annotation json file: failed to load annotations from %s`, opts.AnnotationFilePath),
Recommendation: `Annotation file doesn't match the required format. Please refer to the document at https://oras.land/docs/how_to_guides/manifest_annotations`,
}
return nil, fmt.Errorf("failed to load annotations from %s: %w"+
docLink, opts.AnnotationFilePath, err)
}
}
if len(opts.ManifestAnnotations) != 0 {
Expand Down

0 comments on commit 899f258

Please sign in to comment.