Merge pull request #10257 from akhilerm/fix-unknown-platform

core/image: fix usage of "unknown" platform
This commit is contained in:
Derek McGowan 2024-05-23 21:23:18 +00:00 committed by GitHub
commit 45e30913bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -272,6 +272,9 @@ func Platforms(ctx context.Context, provider content.Provider, image ocispec.Des
var platformSpecs []ocispec.Platform var platformSpecs []ocispec.Platform
return platformSpecs, Walk(ctx, Handlers(HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) { return platformSpecs, Walk(ctx, Handlers(HandlerFunc(func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
if desc.Platform != nil { if desc.Platform != nil {
if desc.Platform.OS == "unknown" || desc.Platform.Architecture == "unknown" {
return nil, ErrSkipDesc
}
platformSpecs = append(platformSpecs, *desc.Platform) platformSpecs = append(platformSpecs, *desc.Platform)
return nil, ErrSkipDesc return nil, ErrSkipDesc
} }