文件下载缺少文件名
This commit is contained in:
@@ -12,6 +12,7 @@ import (
|
|||||||
|
|
||||||
// "log"
|
// "log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -943,6 +944,8 @@ func ResponseFileWithNameAndMD5(w http.ResponseWriter, code int, fileName, path,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
SetCommonResponseHeader(w)
|
SetCommonResponseHeader(w)
|
||||||
|
encodedFileName := url.PathEscape(fileName)
|
||||||
|
w.Header().Set("Content-Disposition", `attachment; filename="`+encodedFileName+`"`)
|
||||||
w.Header().Set("Content-Type", "application/octet-stream")
|
w.Header().Set("Content-Type", "application/octet-stream")
|
||||||
w.Header().Set("User-File", fileName)
|
w.Header().Set("User-File", fileName)
|
||||||
w.Header().Set("MD5-Sum", md5Sum)
|
w.Header().Set("MD5-Sum", md5Sum)
|
||||||
|
|||||||
Reference in New Issue
Block a user