aboutsummaryrefslogtreecommitdiff
path: root/modules/middleware/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/middleware/context.go')
-rw-r--r--modules/middleware/context.go20
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]