From 93f03707a789a4d538c945c9838fa4ec4d3ef15c Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 25 Dec 2015 05:45:07 -0500 Subject: #2283 set text/plain for non-binary files in raw mode --- routers/repo/download.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'routers/repo/download.go') diff --git a/routers/repo/download.go b/routers/repo/download.go index cb863c61..a10792b8 100644 --- a/routers/repo/download.go +++ b/routers/repo/download.go @@ -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) -- cgit v1.2.3