@@ -129,11 +129,14 @@ func (image *Image) Size(ctx context.Context, provider content.Provider, platfor
129129// this direction because this abstraction is not needed.`
130130func Manifest (ctx context.Context , provider content.Provider , image ocispec.Descriptor , platform string ) (ocispec.Manifest , error ) {
131131 var (
132- matcher platforms.Matcher
133- m * ocispec.Manifest
132+ matcher platforms.Matcher
133+ m * ocispec.Manifest
134+ p ocispec.Platform
135+ wasIndex bool
134136 )
135137 if platform != "" {
136- p , err := platforms .Parse (platform )
138+ var err error
139+ p , err = platforms .Parse (platform )
137140 if err != nil {
138141 return ocispec.Manifest {}, err
139142 }
@@ -201,6 +204,8 @@ func Manifest(ctx context.Context, provider content.Provider, image ocispec.Desc
201204 }
202205 }
203206
207+ wasIndex = true
208+
204209 return descs , nil
205210
206211 }
@@ -210,7 +215,11 @@ func Manifest(ctx context.Context, provider content.Provider, image ocispec.Desc
210215 }
211216
212217 if m == nil {
213- return ocispec.Manifest {}, errors .Wrapf (errdefs .ErrNotFound , "manifest %v" , image .Digest )
218+ err := errors .Wrapf (errdefs .ErrNotFound , "manifest %v" , image .Digest )
219+ if wasIndex {
220+ err = errors .Wrapf (errdefs .ErrNotFound , "no match for current platform %s in manifest %v" , platforms .Format (p ), image .Digest )
221+ }
222+ return ocispec.Manifest {}, err
214223 }
215224
216225 return * m , nil
0 commit comments