From 1f66a827e892e0133cee6485095e129f0e5047f0 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 23 Sep 2020 09:57:38 +0200 Subject: remote load: check if input is directory The remote client does not support loading directories yet. To prevent confusing error messages and to make the behaviour more explicit, check if the input points to a directory and throw an error if needed. Signed-off-by: Valentin Rothberg --- pkg/domain/infra/tunnel/images.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pkg') diff --git a/pkg/domain/infra/tunnel/images.go b/pkg/domain/infra/tunnel/images.go index 332a7c2eb..981884109 100644 --- a/pkg/domain/infra/tunnel/images.go +++ b/pkg/domain/infra/tunnel/images.go @@ -199,6 +199,13 @@ func (ir *ImageEngine) Load(ctx context.Context, opts entities.ImageLoadOptions) return nil, err } defer f.Close() + fInfo, err := f.Stat() + if err != nil { + return nil, err + } + if fInfo.IsDir() { + return nil, errors.Errorf("remote client supports archives only but %q is a directory", opts.Input) + } ref := opts.Name if len(opts.Tag) > 0 { ref += ":" + opts.Tag -- cgit v1.2.3-54-g00ecf