fix serve attachment content type
This commit is contained in:
parent
cafde1287e
commit
e67659bf8e
2 changed files with 23 additions and 9 deletions
12
cmd/web.go
12
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue