From 7b7f4215aafb69f0f5c52af4d6c8128b40857ec4 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 17 Dec 2018 00:20:00 -0800 Subject: [PATCH] filer update existing entry --- weed/server/filer_server_handlers_write.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/weed/server/filer_server_handlers_write.go b/weed/server/filer_server_handlers_write.go index 394f32d88..416a7434c 100644 --- a/weed/server/filer_server_handlers_write.go +++ b/weed/server/filer_server_handlers_write.go @@ -187,11 +187,20 @@ func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request) { // update metadata in filer store glog.V(4).Infoln("saving", path, "=>", fileId) + existingEntry, err := fs.filer.FindEntry(filer2.FullPath(path)) + crTime := time.Now() + if err == nil && existingEntry != nil { + if existingEntry.IsDirectory() { + path += ret.Name + } else { + crTime = existingEntry.Crtime + } + } entry := &filer2.Entry{ FullPath: filer2.FullPath(path), Attr: filer2.Attr{ Mtime: time.Now(), - Crtime: time.Now(), + Crtime: crTime, Mode: 0660, Uid: OS_UID, Gid: OS_GID,