Browse Source

修正合并路径后出现的\

master
453530270@qq.com 2 years ago
parent
commit
49106e1442
  1. BIN
      fssc/fssc
  2. 22
      fssc/internal/handler/handler.go

BIN
fssc/fssc

Binary file not shown.

22
fssc/internal/handler/handler.go

@ -120,7 +120,7 @@ func Supfile(w http.ResponseWriter, r *http.Request) {
// 替换 反斜杠
bbpath := strings.Replace(bpath, "/", "\\", -1)
// 拼装, 文件的实际地址
ziprl := filepath.Join(config.G.FilePath, bbpath, "/", bfile)
ziprl := filepath.Join(config.G.FilePath, "/", bbpath, "/", bfile)
// 创建udp 渠道发送数据
message := fmt.Sprintf("%s%s%s", "xdml|", bbpath, "|sender")
@ -129,26 +129,6 @@ func Supfile(w http.ResponseWriter, r *http.Request) {
}
// 文件服务
func FileServerHandler(w http.ResponseWriter, r *http.Request) {
currentPath := config.G.FilePath
fileInfo, err := os.Stat(currentPath)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
basePath := filepath.Base(currentPath)
if fileInfo.IsDir() {
path := r.URL.Path[len("/download/"+basePath):]
fullPath := filepath.Join(currentPath, path)
http.ServeFile(w, r, fullPath)
} else {
http.ServeFile(w, r, currentPath)
}
}
// udp 方式发送zip文件
func SendZip(w http.ResponseWriter, r *http.Request) {
r.ParseForm()

Loading…
Cancel
Save