1
mirror of https://github.com/rclone/rclone synced 2024-11-08 05:31:41 +01:00

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.
This commit is contained in:
Nick Craig-Wood 2017-09-14 18:00:00 +01:00
parent 6df12b3f00
commit 8574129892

View File

@ -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