diff --git a/command/cp.go b/command/cp.go index 7ed06bfee..b539a7512 100644 --- a/command/cp.go +++ b/command/cp.go @@ -488,13 +488,6 @@ func (c Copy) Run(ctx context.Context) error { continue } - if !object.Type.IsRegular() { - err := fmt.Errorf("object '%v' is not a regular file", object) - merrorObjects = multierror.Append(merrorObjects, err) - printError(c.fullCommand, c.op, err) - continue - } - if err := object.Err; err != nil { merrorObjects = multierror.Append(merrorObjects, err) printError(c.fullCommand, c.op, err) @@ -518,6 +511,13 @@ func (c Copy) Run(ctx context.Context) error { continue } + if !object.Type.IsRegular() { + err := fmt.Errorf("object '%v' is not a regular file", object) + merrorObjects = multierror.Append(merrorObjects, err) + printError(c.fullCommand, c.op, err) + continue + } + srcurl := object.URL var task parallel.Task @@ -747,7 +747,6 @@ func (c Copy) doUpload(ctx context.Context, srcurl *url.URL, dsturl *url.URL, ex reader := newCountingReaderWriter(file, c.progressbar) err = dstClient.Put(ctx, reader, dsturl, metadata, c.concurrency, c.partSize) - if err != nil { return err }