|
|
@ -7,6 +7,7 @@ package repo |
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"io" |
|
|
|
"io" |
|
|
|
|
|
|
|
"strings" |
|
|
|
|
|
|
|
|
|
|
|
"code.gitea.io/git" |
|
|
|
"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") |
|
|
|
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") { |
|
|
|
if base.IsTextFile(buf) || ctx.QueryBool("render") { |
|
|
|
ctx.Resp.Header().Set("Content-Type", "text/plain; charset=utf-8") |
|
|
|
ctx.Resp.Header().Set("Content-Type", "text/plain; charset=utf-8") |
|
|
|
} else if base.IsImageFile(buf) || base.IsPDFFile(buf) { |
|
|
|
} else if base.IsImageFile(buf) || base.IsPDFFile(buf) { |
|
|
|