summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2017-05-05 08:03:54 +0200
committerLunny Xiao <xiaolunwen@gmail.com>2017-05-05 14:03:54 +0800
commit935caa7f95f0ce5cc7e01c24bd41b8ffce658581 (patch)
treee5d4d302819f0d2481f779d7dd78e6db90e68dae
parent98460a8d9d9b2bcd31871837ac61d70b153df9c4 (diff)
downloadgitea-935caa7f95f0ce5cc7e01c24bd41b8ffce658581.tar.gz
gitea-935caa7f95f0ce5cc7e01c24bd41b8ffce658581.zip
Download files to their original filename (#1676)
-rw-r--r--routers/repo/download.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/routers/repo/download.go b/routers/repo/download.go
index 8b1bb7f952..78c6088607 100644
--- a/routers/repo/download.go
+++ b/routers/repo/download.go
@@ -7,6 +7,7 @@ package repo
import (
"fmt"
"io"
+ "path"
"strings"
"code.gitea.io/git"
@@ -24,6 +25,7 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
}
ctx.Resp.Header().Set("Cache-Control", "public,max-age=86400")
+ name = path.Base(name)
// Google Chrome dislike commas in filenames, so let's change it to a space
name = strings.Replace(name, ",", " ", -1)