fix to avoid empty sub directory

This commit is contained in:
Chris Lu 2014-03-30 13:32:24 -07:00
parent 51fafdb525
commit d6aa6239de

View file

@ -157,10 +157,12 @@ func (fs *FilerServer) ensureFolderHasEntry(path string, sub string) (err error)
} else if e != nil { } else if e != nil {
return e return e
} }
for _, v := range strings.Split(val, ":") { list := strings.Split(val, ":")
for _, v := range list {
if v == sub { if v == sub {
return nil return nil
} }
} }
return fs.db.Put([]byte(path), []byte(val+":"+sub), nil) list = append(list, sub)
return fs.db.Put([]byte(path), []byte(strings.Join(list, ":")), nil)
} }