unpack: return error when no platforms defined

Require platforms to be non-empty to avoid no-op unpack

Signed-off-by: Derek McGowan <derek@mcg.dev>
This commit is contained in:
Derek McGowan 2022-04-19 14:40:59 -07:00
parent 8017daa12d
commit 39692e7672
No known key found for this signature in database
GPG Key ID: F58C5D0A4405ACDB

View File

@ -145,6 +145,9 @@ func NewUnpacker(ctx context.Context, cs content.Store, opts ...UnpackerOpt) (*U
return nil, err return nil, err
} }
} }
if len(u.platforms) == 0 {
return nil, fmt.Errorf("no unpack platforms defined: %w", errdefs.ErrInvalidArgument)
}
return u, nil return u, nil
} }