Skip to content

Commit 8bbc51e

Browse files
jpraetKN4CK3R
andauthored
Apply suggested change to routers/common/repo.go
Co-authored-by: KN4CK3R <[email protected]>
1 parent c95383b commit 8bbc51e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

routers/common/repo.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,10 @@ func ServeData(ctx *context.Context, name string, size int64, reader io.Reader)
7575
log.Error("Detect raw file %s charset failed: %v, using by default utf-8", name, err)
7676
cs = "utf-8"
7777
}
78-
if mappedMimeType != "" {
79-
ctx.Resp.Header().Set("Content-Type", mappedMimeType+"; charset="+strings.ToLower(cs))
80-
} else {
81-
ctx.Resp.Header().Set("Content-Type", "text/plain; charset="+strings.ToLower(cs))
78+
if mappedMimeType == "" {
79+
mappedMimeType = "text/plain"
8280
}
81+
ctx.Resp.Header().Set("Content-Type", mappedMimeType+"; charset="+strings.ToLower(cs))
8382
} else {
8483
ctx.Resp.Header().Set("Access-Control-Expose-Headers", "Content-Disposition")
8584
if mappedMimeType != "" {

0 commit comments

Comments
 (0)