swift: return directories without / in ListDir

This commit is contained in:
Nick Craig-Wood 2014-07-24 22:51:10 +01:00
parent a5b0d88608
commit b013c58537

View File

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