From 4b9ed98ff8c4d11c2d43029d1d36417d7c065a36 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 17 Aug 2023 10:39:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD=E7=BC=BA?= =?UTF-8?q?=E5=B0=91=E6=96=87=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/services/services.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/services/services.go b/lib/services/services.go index adae0c1e..4413a833 100644 --- a/lib/services/services.go +++ b/lib/services/services.go @@ -12,6 +12,7 @@ import ( // "log" "net/http" + "net/url" "strconv" "strings" @@ -943,6 +944,8 @@ func ResponseFileWithNameAndMD5(w http.ResponseWriter, code int, fileName, path, return } 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("User-File", fileName) w.Header().Set("MD5-Sum", md5Sum)