From 0a7e05ee6539fd95729ef21447532e67d8bc1bfd Mon Sep 17 00:00:00 2001 From: jqzhang Date: Tue, 23 Jul 2019 09:03:05 +0800 Subject: [PATCH] bugfix checkfileexist offset -1 --- fileserver.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/fileserver.go b/fileserver.go index 1a48544..770bbaa 100644 --- a/fileserver.go +++ b/fileserver.go @@ -1465,12 +1465,21 @@ func (this *Server) CheckFileExist(w http.ResponseWriter, r *http.Request) { if fpath != "" { fi, err = os.Stat(fpath) if err == nil { + sum := this.util.MD5(fpath) + //if Config().EnableDistinctFile { + // sum, err = this.util.GetFileSumByName(fpath, Config().FileSumArithmetic) + // if err != nil { + // log.Error(err) + // } + //} fileInfo = &FileInfo{ - Path: path.Dir(fpath), - Name: path.Base(fpath), - Size: fi.Size(), - Md5: this.util.MD5(fpath), - Peers: []string{Config().Host}, + Path: path.Dir(fpath), + Name: path.Base(fpath), + Size: fi.Size(), + Md5: sum, + Peers: []string{Config().Host}, + OffSet: -1, //very important + TimeStamp: fi.ModTime().Unix(), } data, err = json.Marshal(fileInfo) w.Write(data)