mirror of
https://gitee.com/sjqzhang/go-fastdfs.git
synced 2024-11-30 02:07:45 +08:00
bugfix checkfileexist offset -1
This commit is contained in:
parent
e87241a4c9
commit
6c43105fc1
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user