Browse Source

Download files to their original filename (#1676)

master
silverwind Lunny Xiao 8 years ago
parent
commit
935caa7f95
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      routers/repo/download.go

+ 2
- 0
routers/repo/download.go View File

@@ -7,6 +7,7 @@ package repo
import (
"fmt"
"io"
"path"
"strings"

"code.gitea.io/git"
@@ -24,6 +25,7 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
}

ctx.Resp.Header().Set("Cache-Control", "public,max-age=86400")
name = path.Base(name)

// Google Chrome dislike commas in filenames, so let's change it to a space
name = strings.Replace(name, ",", " ", -1)


Loading…
Cancel
Save