From 39692e7672ac0ca14e6845ae533ceaa5eaa45921 Mon Sep 17 00:00:00 2001 From: Derek McGowan Date: Tue, 19 Apr 2022 14:40:59 -0700 Subject: [PATCH] unpack: return error when no platforms defined Require platforms to be non-empty to avoid no-op unpack Signed-off-by: Derek McGowan --- pkg/unpack/unpacker.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/unpack/unpacker.go b/pkg/unpack/unpacker.go index 136a128ea..6d6f79def 100644 --- a/pkg/unpack/unpacker.go +++ b/pkg/unpack/unpacker.go @@ -145,6 +145,9 @@ func NewUnpacker(ctx context.Context, cs content.Store, opts ...UnpackerOpt) (*U return nil, err } } + if len(u.platforms) == 0 { + return nil, fmt.Errorf("no unpack platforms defined: %w", errdefs.ErrInvalidArgument) + } return u, nil }