Browse Source

support chinese file_name download

tags/v1.21.12.1
lewis 4 years ago
parent
commit
dac3b45a1f
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      routers/repo/download.go

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

@@ -8,6 +8,7 @@ package repo
import ( import (
"fmt" "fmt"
"io" "io"
"net/url"
"path" "path"
"strings" "strings"


@@ -32,6 +33,7 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {


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


if base.IsTextFile(buf) || ctx.QueryBool("render") { if base.IsTextFile(buf) || ctx.QueryBool("render") {
cs, err := charset.DetectEncoding(buf) cs, err := charset.DetectEncoding(buf)


Loading…
Cancel
Save