From d6aa6239deed6936d4c5ee81ad38d0e16ad1bd1a Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 30 Mar 2014 13:32:24 -0700 Subject: [PATCH] fix to avoid empty sub directory --- go/weed/weed_server/filer_server.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/go/weed/weed_server/filer_server.go b/go/weed/weed_server/filer_server.go index ffcb64cfc..c80b3b56f 100644 --- a/go/weed/weed_server/filer_server.go +++ b/go/weed/weed_server/filer_server.go @@ -157,10 +157,12 @@ func (fs *FilerServer) ensureFolderHasEntry(path string, sub string) (err error) } else if e != nil { return e } - for _, v := range strings.Split(val, ":") { + list := strings.Split(val, ":") + for _, v := range list { if v == sub { 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) }