From 935caa7f95f0ce5cc7e01c24bd41b8ffce658581 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 5 May 2017 08:03:54 +0200 Subject: [PATCH] Download files to their original filename (#1676) --- routers/repo/download.go | 2 ++ 1 file changed, 2 insertions(+) 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)