Ensure specifying an empty platform is treated as default
The default platform had previously been provided using the
empty string. This change ensures that the platforms
field is always filled in correctly and empty string is
properly interpreted.
@@ -18,6 +18,7 @@ package containerd
import (
"github.com/containerd/containerd/images"
+ "github.com/containerd/containerd/platforms"
"github.com/containerd/containerd/remotes"
"google.golang.org/grpc"
)
@@ -76,6 +77,9 @@ type RemoteOpt func(*Client, *RemoteContext) error
// WithPlatform allows the caller to specify a platform to retrieve
// content for
func WithPlatform(platform string) RemoteOpt {
+ if platform == "" {
+ platform = platforms.Default()
+ }
return func(_ *Client, c *RemoteContext) error {
for _, p := range c.Platforms {
if p == platform {
