Browse Source

Set utf-8 charset for text files when serving raw content (#2898)

pull/3121/head
Tamás Molnár 9 years ago committed by Unknwon
parent
commit
39356f4238
  1. 2
      routers/repo/download.go

2
routers/repo/download.go

@ -29,7 +29,7 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary") ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
} }
} else { } else {
ctx.Resp.Header().Set("Content-Type", "text/plain") ctx.Resp.Header().Set("Content-Type", "text/plain; charset=utf-8")
} }
ctx.Resp.Write(buf) ctx.Resp.Write(buf)
_, err := io.Copy(ctx.Resp, reader) _, err := io.Copy(ctx.Resp, reader)

Loading…
Cancel
Save