From d97f17facb0df381e54afb5f0485e7c2c8f04b71 Mon Sep 17 00:00:00 2001 From: Equim Date: Tue, 23 Jan 2018 16:28:08 +0800 Subject: [PATCH] http: download: use PathEscape instead of QueryEscape (#340) --- http/download.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/http/download.go b/http/download.go index bfc8b6e4..5622a3b9 100644 --- a/http/download.go +++ b/http/download.go @@ -71,7 +71,7 @@ func downloadHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int } name += extension - w.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+url.QueryEscape(name)) + w.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(name)) err := ar.Write(w, files) return 0, err @@ -94,7 +94,7 @@ func downloadFileHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) w.Header().Set("Content-Disposition", "inline") } else { // As per RFC6266 section 4.3 - w.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+url.QueryEscape(c.File.Name)) + w.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(c.File.Name)) } http.ServeContent(w, r, stat.Name(), stat.ModTime(), file)