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: return directories without / in ListDir

Nick Craig-Woodb013c5853720
diff --git a/swift/swift.go b/swift/swift.go
index 2bba19238..29f27805d 100644
--- a/swift/swift.go
+++ b/swift/swift.go
@@ -201,8 +201,11 @@ func (f *FsSwift) list(directories bool, fn func(string, *swift.Object)) {
for i := range objects {
object := &objects[i]
// FIXME if there are no directories, swift gives back the files for some reason!
- if directories && !strings.HasSuffix(object.Name, "/") {
- continue
+ if directories {
+ if !strings.HasSuffix(object.Name, "/") {
+ continue
+ }
+ object.Name = object.Name[:len(object.Name)-1]
}
if !strings.HasPrefix(object.Name, f.root) {
fs.Log(f, "Odd name received %q", object.Name)