0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-10-31 11:19:07 +01:00

fix download

This commit is contained in:
slene 2014-03-28 00:38:44 +08:00
parent bce8586bc6
commit 417d861be6

View file

@ -243,7 +243,7 @@ func SingleDownload(ctx *middleware.Context, params martini.Params) {
contentType, isTextFile := base.IsTextFile(data) contentType, isTextFile := base.IsTextFile(data)
_, isImageFile := base.IsImageFile(data) _, isImageFile := base.IsImageFile(data)
ctx.Res.Header().Set("Content-Type", contentType) ctx.Res.Header().Set("Content-Type", contentType)
if !isTextFile { if !isTextFile && !isImageFile {
ctx.Res.Header().Set("Content-Disposition", "attachment; filename="+filepath.Base(treename)) ctx.Res.Header().Set("Content-Disposition", "attachment; filename="+filepath.Base(treename))
ctx.Res.Header().Set("Content-Transfer-Encoding", "binary") ctx.Res.Header().Set("Content-Transfer-Encoding", "binary")
} }