forked from forgejo/forgejo
router/repo: code refactoring
This commit is contained in:
parent
2a13f682e0
commit
780cc2d110
13 changed files with 253 additions and 261 deletions
|
@ -21,10 +21,8 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
|
|||
buf = buf[:n]
|
||||
}
|
||||
|
||||
_, isTextFile := base.IsTextFile(buf)
|
||||
if !isTextFile {
|
||||
_, isImageFile := base.IsImageFile(buf)
|
||||
if !isImageFile {
|
||||
if !base.IsTextFile(buf) {
|
||||
if !base.IsImageFile(buf) {
|
||||
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename=\""+path.Base(ctx.Repo.TreePath)+"\"")
|
||||
ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue