summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-10-06 08:43:42 -0700
committerCorey Hulen <corey@hulen.com>2015-10-06 08:43:42 -0700
commit3543dc5ff329ab19334ad97b1993538aa5be6593 (patch)
tree36294d377ade864d0cc4832f858109e392290b71
parent429cc6e0e6ac0e34d0216745bec0c4eb9684108c (diff)
parentab32445a6836d8524c4eb02542656ef38b7503a8 (diff)
downloadchat-3543dc5ff329ab19334ad97b1993538aa5be6593.tar.gz
chat-3543dc5ff329ab19334ad97b1993538aa5be6593.tar.bz2
chat-3543dc5ff329ab19334ad97b1993538aa5be6593.zip
Merge pull request #937 from mattermost/plt-230
PLT-230 Use HTTP writer to automatically set content-type for file GETs.
-rw-r--r--api/file.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/api/file.go b/api/file.go
index 5dc1db650..bb9aa00d8 100644
--- a/api/file.go
+++ b/api/file.go
@@ -23,7 +23,6 @@ import (
"image/jpeg"
"io"
"io/ioutil"
- "mime"
"net/http"
"net/url"
"os"
@@ -407,7 +406,7 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "max-age=2592000, public")
w.Header().Set("Content-Length", strconv.Itoa(len(f)))
- w.Header().Set("Content-Type", mime.TypeByExtension(filepath.Ext(filename)))
+ w.Header().Del("Content-Type") // Content-Type will be set automatically by the http writer
// attach extra headers to trigger a download on IE and Edge
ua := user_agent.New(r.UserAgent())