diff options
author | Andrey Nering <andrey.nering@gmail.com> | 2016-11-26 11:26:03 -0200 |
---|---|---|
committer | Andrey Nering <andrey.nering@gmail.com> | 2016-11-26 11:26:03 -0200 |
commit | d647d02c2f9816effd50b2eea45aa65fb1b4047c (patch) | |
tree | da59362026de242a04909063a6a230477a31c021 /routers/repo/download.go | |
parent | 638dd24cec6f2951ecd4550165b858138c4c3f40 (diff) | |
download | gitea-d647d02c2f9816effd50b2eea45aa65fb1b4047c.tar.gz gitea-d647d02c2f9816effd50b2eea45aa65fb1b4047c.zip |
Fix Chrome not liking commas
Diffstat (limited to 'routers/repo/download.go')
-rw-r--r-- | routers/repo/download.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/routers/repo/download.go b/routers/repo/download.go index aba0971a4a..85e9fc64c9 100644 --- a/routers/repo/download.go +++ b/routers/repo/download.go @@ -7,6 +7,7 @@ package repo import ( "fmt" "io" + "strings" "code.gitea.io/git" @@ -24,6 +25,9 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error { ctx.Resp.Header().Set("Cache-Control", "public,max-age=86400") + // Google Chrome dislike commas in filenames, so let's change it to a space + name = strings.Replace(name, ",", " ", -1) + if base.IsTextFile(buf) || ctx.QueryBool("render") { ctx.Resp.Header().Set("Content-Type", "text/plain; charset=utf-8") } else if base.IsImageFile(buf) || base.IsPDFFile(buf) { |