From eebc47e22caed2394e6f45d22fbea3f3a842c0f5 Mon Sep 17 00:00:00 2001 From: Leenear Date: Wed, 27 May 2026 00:49:33 +0400 Subject: [PATCH] fix parsing error on filenames Wrap the downloaded filename in double quotes to prevent HTTP header parsing errors on filenames with spaces. --- internal/handler/handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/handler/handler.go b/internal/handler/handler.go index d9ef4d5..cc9b1f5 100644 --- a/internal/handler/handler.go +++ b/internal/handler/handler.go @@ -143,7 +143,7 @@ func (n *Node) DownloadGuide(w http.ResponseWriter, r *http.Request) { return } w.Header().Set("Content-Type", "text/markdown; charset=utf-8") - w.Header().Set("Content-Disposition", "attachment; filename="+filepath.Base(path)) + w.Header().Set("Content-Disposition", `attachment; filename="`+filepath.Base(path)+`"`) w.Header().Set("X-Content-Type-Options", "nosniff") w.Write(raw) }