forked from TrueCloudLab/rclone
swift: fix zero length directory markekrs showing in the subdirectory listing
This was causing lots of duplicated files to be copied.
This commit is contained in:
parent
78f33f5d6e
commit
93423a0812
1 changed files with 7 additions and 1 deletions
|
@ -297,10 +297,16 @@ func (f *Fs) listContainerRoot(container, root string, dir string, recurse bool,
|
||||||
if !recurse {
|
if !recurse {
|
||||||
isDirectory = strings.HasSuffix(object.Name, "/")
|
isDirectory = strings.HasSuffix(object.Name, "/")
|
||||||
}
|
}
|
||||||
if !strings.HasPrefix(object.Name, root) {
|
if !strings.HasPrefix(object.Name, prefix) {
|
||||||
fs.Logf(f, "Odd name received %q", object.Name)
|
fs.Logf(f, "Odd name received %q", object.Name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if object.Name == prefix {
|
||||||
|
// If we have zero length directory markers ending in / then swift
|
||||||
|
// will return them in the listing for the directory which causes
|
||||||
|
// duplicate directories. Ignore them here.
|
||||||
|
continue
|
||||||
|
}
|
||||||
remote := object.Name[rootLength:]
|
remote := object.Name[rootLength:]
|
||||||
err = fn(remote, object, isDirectory)
|
err = fn(remote, object, isDirectory)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue