From 083f05080b36f6e0e8af9bcf2696cf293dd8db57 Mon Sep 17 00:00:00 2001 From: Mael Regnery Date: Tue, 10 Dec 2024 14:10:12 +0100 Subject: [PATCH] fix: exclude non-regular files --- command/cp.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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 }