From 8574129892ac27c710acaabbaa32c79909275c08 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 14 Sep 2017 18:00:00 +0100 Subject: [PATCH] swift: fix server side copy to empty container with --fast-list This was caused by an incorrect error return code from ListR when the container did not exist. --- swift/swift.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/swift/swift.go b/swift/swift.go index 9f496b79f..c97e5e959 100644 --- a/swift/swift.go +++ b/swift/swift.go @@ -360,7 +360,7 @@ type addEntryFn func(fs.DirEntry) error // list the objects into the function supplied func (f *Fs) list(dir string, recurse bool, fn addEntryFn) error { - return f.listContainerRoot(f.container, f.root, dir, recurse, func(remote string, object *swift.Object, isDirectory bool) (err error) { + err := f.listContainerRoot(f.container, f.root, dir, recurse, func(remote string, object *swift.Object, isDirectory bool) (err error) { if isDirectory { remote = strings.TrimRight(remote, "/") d := fs.NewDir(remote, time.Time{}).SetSize(object.Bytes) @@ -377,6 +377,10 @@ func (f *Fs) list(dir string, recurse bool, fn addEntryFn) error { } return err }) + if err == swift.ContainerNotFound { + err = fs.ErrorDirNotFound + } + return err } // listDir lists a single directory @@ -390,9 +394,6 @@ func (f *Fs) listDir(dir string) (entries fs.DirEntries, err error) { return nil }) if err != nil { - if err == swift.ContainerNotFound { - err = fs.ErrorDirNotFound - } return nil, err } return entries, nil