mirror of
https://github.com/rclone/rclone.git
synced 2024-12-22 23:22:08 +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:
parent
6df12b3f00
commit
8574129892
@ -360,7 +360,7 @@ type addEntryFn func(fs.DirEntry) error
|
|||||||
|
|
||||||
// list the objects into the function supplied
|
// list the objects into the function supplied
|
||||||
func (f *Fs) list(dir string, recurse bool, fn addEntryFn) error {
|
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 {
|
if isDirectory {
|
||||||
remote = strings.TrimRight(remote, "/")
|
remote = strings.TrimRight(remote, "/")
|
||||||
d := fs.NewDir(remote, time.Time{}).SetSize(object.Bytes)
|
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
|
return err
|
||||||
})
|
})
|
||||||
|
if err == swift.ContainerNotFound {
|
||||||
|
err = fs.ErrorDirNotFound
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// listDir lists a single directory
|
// listDir lists a single directory
|
||||||
@ -390,9 +394,6 @@ func (f *Fs) listDir(dir string) (entries fs.DirEntries, err error) {
|
|||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == swift.ContainerNotFound {
|
|
||||||
err = fs.ErrorDirNotFound
|
|
||||||
}
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return entries, nil
|
return entries, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user