From ab32445a6836d8524c4eb02542656ef38b7503a8 Mon Sep 17 00:00:00 2001 From: JoramWilander Date: Tue, 6 Oct 2015 09:09:52 -0400 Subject: Use http writer to automatically set content-type for file gets. --- api/file.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'api') 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()) -- cgit v1.2.3-1-g7c22