Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

swift,hubic: fix paged directory listings

Nick Craig-Woodce1b9a7dafd5
diff --git a/swift/swift.go b/swift/swift.go
index f8ab4563f..770c81d25 100644
--- a/swift/swift.go
+++ b/swift/swift.go
@@ -295,10 +295,7 @@ func (f *Fs) listContainerRoot(container, root string, dir string, recurse bool,
object := &objects[i]
isDirectory := false
if !recurse {
- if strings.HasSuffix(object.Name, "/") {
- isDirectory = true
- object.Name = object.Name[:len(object.Name)-1]
- }
+ isDirectory = strings.HasSuffix(object.Name, "/")
}
if !strings.HasPrefix(object.Name, root) {
fs.Logf(f, "Odd name received %q", object.Name)
@@ -321,6 +318,7 @@ type addEntryFn func(fs.DirEntry) 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) {
if isDirectory {
+ remote = strings.TrimRight(remote, "/")
d := fs.NewDir(remote, time.Time{}).SetSize(object.Bytes)
err = fn(d)
} else {