summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-12 04:49:51 +0800
committerUnknwon <u@gogs.io>2015-08-12 04:49:51 +0800
commite67659bf8e76763bdfdfe02d87359255b7acd19b (patch)
tree63f7c467fed06252d263f6d3bfce00bfbe9ceaec /cmd
parentcafde1287ebb58ad6b862e3cc4ef7d4dece82ddb (diff)
downloadgitea-e67659bf8e76763bdfdfe02d87359255b7acd19b.tar.gz
gitea-e67659bf8e76763bdfdfe02d87359255b7acd19b.zip
fix serve attachment content type
Diffstat (limited to 'cmd')
-rw-r--r--cmd/web.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/cmd/web.go b/cmd/web.go
index decad7d34f..6ca771e230 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -338,9 +338,19 @@ func runWeb(ctx *cli.Context) {
return
}
+ fr, err := os.Open(attach.LocalPath())
+ if err != nil {
+ ctx.Handle(500, "Open", err)
+ return
+ }
+ defer fr.Close()
+
// Fix #312. Attachments with , in their name are not handled correctly by Google Chrome.
// We must put the name in " manually.
- ctx.ServeFileContent(attach.LocalPath(), "\""+attach.Name+"\"")
+ if err = repo.ServeData(ctx, "\""+attach.Name+"\"", fr); err != nil {
+ ctx.Handle(500, "ServeData", err)
+ return
+ }
})
m.Post("/issues/attachments", repo.UploadIssueAttachment)
}, ignSignIn)