1
0
Fork 0

routers/repo: set raw page content type to 'text/plain' #828

This commit is contained in:
Unknwon 2015-01-31 15:27:57 -05:00
parent fb9dcfa921
commit 32152d2363
5 changed files with 9 additions and 7 deletions

View file

@ -13,6 +13,7 @@ Gogs(Go Git Service) is a painless self-hosted Git Service written in Go.
- Due to testing purpose, data of [try.gogs.io](https://try.gogs.io) has been reset in **Jan 28, 2015** and will reset multiple times after. Please do **NOT** put your important data on the site. - Due to testing purpose, data of [try.gogs.io](https://try.gogs.io) has been reset in **Jan 28, 2015** and will reset multiple times after. Please do **NOT** put your important data on the site.
- Demo site [try.gogs.io](https://try.gogs.io) is running under `dev` branch. - Demo site [try.gogs.io](https://try.gogs.io) is running under `dev` branch.
- If you think there are vulnerabilities in the project, please talk private to **u@gogs.io**, thanks!
#### Other language version #### Other language version

View file

@ -1,6 +1,7 @@
# This file lists all PUBLIC individuals having contributed content to the translation. # This file lists all PUBLIC individuals having contributed content to the translation.
# Order of name is meaningless. # Order of name is meaningless.
Christoph Kisfeld <christoph.kisfeld@gmail.com>
Thomas Fanninger <gogs.thomas@fanninger.at> Thomas Fanninger <gogs.thomas@fanninger.at>
Łukasz Jan Niemier <lukasz@niemier.pl> Łukasz Jan Niemier <lukasz@niemier.pl>
Lafriks <lafriks@gmail.com> Lafriks <lafriks@gmail.com>

View file

@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )
const APP_VER = "0.5.12.0130 Beta" const APP_VER = "0.5.12.0131 Beta"
func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())

View file

@ -25,16 +25,16 @@ func ServeBlob(ctx *middleware.Context, blob *git.Blob) error {
buf = buf[:n] buf = buf[:n]
} }
contentType, isTextFile := base.IsTextFile(buf) _, isTextFile := base.IsTextFile(buf)
_, isImageFile := base.IsImageFile(buf) _, isImageFile := base.IsImageFile(buf)
ctx.Resp.Header().Set("Content-Type", contentType) ctx.Resp.Header().Set("Content-Type", "text/plain")
if !isTextFile && !isImageFile { if !isTextFile && !isImageFile {
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(ctx.Repo.TreeName)) ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(ctx.Repo.TreeName))
ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary") ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
} }
ctx.Resp.Write(buf) ctx.Resp.Write(buf)
io.Copy(ctx.Resp, dataRc) _, err = io.Copy(ctx.Resp, dataRc)
return nil return err
} }
func SingleDownload(ctx *middleware.Context) { func SingleDownload(ctx *middleware.Context) {

View file

@ -1 +1 @@
0.5.12.0130 Beta 0.5.12.0131 Beta