]> source.dussan.org Git - gitea.git/commitdiff
don't set mime type to text/plain. This will break serving e.g. raw images,
authorDon Bowman <don.waterloo@gmail.com>
Wed, 8 Apr 2015 00:44:38 +0000 (00:44 +0000)
committerDon Bowman <don.waterloo@gmail.com>
Wed, 8 Apr 2015 00:44:38 +0000 (00:44 +0000)
html, etc

According to http://golang.org/pkg/net/http/#DetectContentType
"If the Header does not contain a Content-Type line, Write adds
a Content-Type set to the result of passing the initial 512 bytes
of written data to DetectContentType."

routers/repo/download.go

index c5e18e005b7a477a1f4340d14bf5934460361690..b1c5fbc84dc7766ebbda6d537882bdca632ccf34 100644 (file)
@@ -27,7 +27,6 @@ func ServeBlob(ctx *middleware.Context, blob *git.Blob) error {
 
        _, isTextFile := base.IsTextFile(buf)
        _, isImageFile := base.IsImageFile(buf)
-       ctx.Resp.Header().Set("Content-Type", "text/plain")
        if !isTextFile && !isImageFile {
                ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(ctx.Repo.TreeName))
                ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")