#2283 set text/plain for non-binary files in raw mode

This commit is contained in:
Unknwon 2015-12-25 05:45:07 -05:00
parent 85af36332b
commit 93f03707a7
5 changed files with 10 additions and 4 deletions

View file

@ -28,6 +28,8 @@ func ServeData(ctx *middleware.Context, name string, reader io.Reader) error {
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(ctx.Repo.TreeName))
ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
}
} else {
ctx.Resp.Header().Set("Content-Type", "text/plain")
}
ctx.Resp.Write(buf)
_, err := io.Copy(ctx.Resp, reader)