index
:
gogs.git
Gogs is a painless self-hosted Git service
log msg
author
committer
range
buildscript
main
mygogs
about
summary
refs
log
tree
commit
diff
path:
root
/
routers
/
repo
/
download.go
diff options
context:
1
2
3
4
5
6
7
8
9
10
15
20
25
30
35
40
space:
include
ignore
mode:
unified
ssdiff
stat only
author
无闻 <u@gogs.io>
2015-08-14 13:38:14 +0800
committer
无闻 <u@gogs.io>
2015-08-14 13:38:14 +0800
commit
8be0bb177b3f28b5cb0afb87bb18db208a11f67d
(
patch
)
tree
1aad59af4a874d42621d2a56c7addd5cf012de95
/
routers/repo/download.go
parent
a463ac178e3d62b9d4e51e727fb8b8927a8bacee
(
diff
)
parent
4137426c8836686f06e6de21e7c586df3e798c3a
(
diff
)
Merge pull request #1485 from donbowman/mime-type
43bfee0d4872932c1da185e8367e21795bc4ceb5 reverted my change
Diffstat
(limited to 'routers/repo/download.go')
-rw-r--r--
routers/repo/download.go
7
1 files changed, 1 insertions, 6 deletions
diff --git a/routers/repo/download.go b/routers/repo/download.go
index a0a7823b..d657d9b1 100644
--- a/
routers/repo/download.go
+++ b/
routers/repo/download.go
@@ -21,12 +21,7 @@ func ServeData(ctx *middleware.Context, name string, reader io.Reader) error {
}
_, isTextFile := base.IsTextFile(buf)
- if isTextFile {
- charset, _ := base.DetectEncoding(buf)
- if charset != "UTF-8" {
- ctx.Resp.Header().Set("Content-Type", "text/plain; charset="+charset)
- }
- } else {
+ if ! isTextFile {
_, isImageFile := base.IsImageFile(buf)
if !isImageFile {
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(ctx.Repo.TreeName))