diff options
author | Michael Boke <michael@mbict.nl> | 2014-10-03 22:51:07 +0200 |
---|---|---|
committer | Michael Boke <michael@mbict.nl> | 2014-10-03 22:51:07 +0200 |
commit | ba1270df2d3d835b397317f133963e7b517242f1 (patch) | |
tree | 1265a142a1fd9951d30ae11648e7fbfb5806e594 /modules/middleware/context.go | |
parent | ba0feadc34400cb91ff23f66096884d862651cdd (diff) | |
parent | 405ee14711ab946bd709ec28a526890c40cbc03b (diff) |
Merge remote-tracking branch 'upstream/master'
Conflicts:
conf/app.ini
Diffstat (limited to 'modules/middleware/context.go')
-rw-r--r-- | modules/middleware/context.go | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/modules/middleware/context.go b/modules/middleware/context.go index 3ef1b1d6..90716d2c 100644 --- a/modules/middleware/context.go +++ b/modules/middleware/context.go @@ -9,7 +9,6 @@ import ( "html/template" "io" "net/http" - "path" "strings" "time" @@ -140,23 +139,6 @@ func (ctx *Context) Handle(status int, title string, err error) { ctx.HTML(status, base.TplName(fmt.Sprintf("status/%d", status))) } -func (ctx *Context) ServeFile(file string, names ...string) { - var name string - if len(names) > 0 { - name = names[0] - } else { - name = path.Base(file) - } - ctx.Resp.Header().Set("Content-Description", "File Transfer") - ctx.Resp.Header().Set("Content-Type", "application/octet-stream") - ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+name) - ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary") - ctx.Resp.Header().Set("Expires", "0") - ctx.Resp.Header().Set("Cache-Control", "must-revalidate") - ctx.Resp.Header().Set("Pragma", "public") - http.ServeFile(ctx.Resp, ctx.Req, file) -} - func (ctx *Context) ServeContent(name string, r io.ReadSeeker, params ...interface{}) { modtime := time.Now() for _, p := range params { @@ -187,7 +169,7 @@ func Contexter() macaron.Handler { Session: sess, } // Compute current URL for real-time change language. - link := ctx.Req.RequestURI + link := setting.AppSubUrl + ctx.Req.RequestURI i := strings.Index(link, "?") if i > -1 { link = link[:i] |