diff --git a/APIServer.exe b/APIServer.exe index b4e6f31..36bfdbe 100644 Binary files a/APIServer.exe and b/APIServer.exe differ diff --git a/APIServer.go b/APIServer.go index 2a2674e..e4f67a1 100644 --- a/APIServer.go +++ b/APIServer.go @@ -3,6 +3,8 @@ package main import ( "APIServer/cnf" "APIServer/ews" + "crypto/md5" + "encoding/hex" "encoding/json" "errors" "flag" @@ -311,7 +313,7 @@ func handleFileInfo(w http.ResponseWriter, r *http.Request) { FileName string `json:"FileName"` FileSize int64 `json:"FileSize"` LastModified string `json:"LastModified"` - //MD5Hash string `json:"MD5Hash"` + MD5Hash string `json:"MD5Hash"` } type FileList struct { FileList []FileInfo `json:"FileList"` @@ -324,7 +326,7 @@ func handleFileInfo(w http.ResponseWriter, r *http.Request) { fileInfo.FileName = info.Name() fileInfo.FileSize = info.Size() fileInfo.LastModified = info.ModTime().Format("2006-01-02 15:04:05") - //fileInfo.MD5Hash = fileMD5(path) + fileInfo.MD5Hash = fileMD5(path) infoList = append(infoList, fileInfo) } return nil @@ -471,7 +473,7 @@ func parseReqParams(r *http.Request) (map[string]string, error) { return params, nil } -/* func fileMD5(filePath string) string { +func fileMD5(filePath string) string { file, err := os.Open(filePath) if err != nil { return "" @@ -482,7 +484,7 @@ func parseReqParams(r *http.Request) (map[string]string, error) { return "" } return hex.EncodeToString(hash.Sum(nil)) -} */ +} func chkParams(arg string) bool { if strings.Contains(arg, ";") ||