Update fileserver.go

This commit is contained in:
小张 2018-12-31 11:26:51 +08:00 committed by GitHub
parent ae9baab679
commit dcc3dcfbc9

View File

@ -499,6 +499,13 @@ func (this *Server) Upload(w http.ResponseWriter, r *http.Request) {
md5sum = util.GetFileMd5(uploadFile)
if info, _ := this.GetFileInfoByMd5(md5sum); info != nil && info.Path != "" && info.Path != folder {
os.Remove(folder + "/" + name)
download_url := fmt.Sprintf("http://%s/%s", r.Host, info.Path+"/"+info.Name)
w.Write([]byte(download_url))
return
}
} else {
v := util.GetFileMd5(uploadFile)