Skip to content

Commit 935caa7

Browse files
silverwindlunny
authored andcommitted
Download files to their original filename (#1676)
1 parent 98460a8 commit 935caa7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

routers/repo/download.go

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package repo
77
import (
88
"fmt"
99
"io"
10+
"path"
1011
"strings"
1112

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

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

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

0 commit comments

Comments
 (0)