From 09c8ae421a863bb1055e8199d8b1e54851caaaef Mon Sep 17 00:00:00 2001 From: smail Date: Sun, 4 Oct 2026 12:15:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=99=84=E4=BB=B6=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E5=93=8D=E5=BA=94=E9=95=BF=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/controllers/attachments.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/controllers/attachments.go b/backend/controllers/attachments.go index e33a7b5..89539a1 100644 --- a/backend/controllers/attachments.go +++ b/backend/controllers/attachments.go @@ -10,6 +10,7 @@ import ( "github.com/spf13/cast" "net/http" "net/url" + "strconv" "strings" "unicode" ) @@ -50,6 +51,7 @@ func Download(ctx *context.Context, w http.ResponseWriter, req *http.Request) { } fileName = safeDownloadName(fileName) w.Header().Set("Content-Type", "application/octet-stream") + w.Header().Set("Content-Length", strconv.Itoa(len(content))) w.Header().Set("X-Content-Type-Options", "nosniff") w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"attachment\"; filename*=UTF-8''%s", url.PathEscape(fileName))) if _, err := w.Write(content); err != nil {