From dac3b45a1f8440688c690cbb55adad135d49d641 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Thu, 8 Jul 2021 16:53:06 +0800 Subject: [PATCH] support chinese file_name download --- routers/repo/download.go | 2 ++ 1 file changed, 2 insertions(+) mode change 100644 => 100755 routers/repo/download.go diff --git a/routers/repo/download.go b/routers/repo/download.go old mode 100644 new mode 100755 index 7ef0574b1..5b8982102 --- a/routers/repo/download.go +++ b/routers/repo/download.go @@ -8,6 +8,7 @@ package repo import ( "fmt" "io" + "net/url" "path" "strings" @@ -32,6 +33,7 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error { // Google Chrome dislike commas in filenames, so let's change it to a space name = strings.Replace(name, ",", " ", -1) + name = url.QueryEscape(name) if base.IsTextFile(buf) || ctx.QueryBool("render") { cs, err := charset.DetectEncoding(buf)