diff options
author | Joram Wilander <jwawilander@gmail.com> | 2015-09-22 14:08:32 -0400 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2015-09-22 14:08:32 -0400 |
commit | a44e8f0cd904d386caea410398dcaf7dbfd9c138 (patch) | |
tree | 5432387e2ae04abc6eedabb695e029e426cdad23 /api | |
parent | e9a2c223f2f247a773d04c4c23417393ca75b3dc (diff) | |
parent | 602bed85f2b32733f73e2edddb542fa36baac462 (diff) | |
download | chat-a44e8f0cd904d386caea410398dcaf7dbfd9c138.tar.gz chat-a44e8f0cd904d386caea410398dcaf7dbfd9c138.tar.bz2 chat-a44e8f0cd904d386caea410398dcaf7dbfd9c138.zip |
Merge pull request #710 from jdeng/master
content type for getFile()
Diffstat (limited to 'api')
-rw-r--r-- | api/file.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/api/file.go b/api/file.go index 467bf5338..3602b5ed4 100644 --- a/api/file.go +++ b/api/file.go @@ -24,6 +24,7 @@ import ( "io" "io/ioutil" "math" + "mime" "net/http" "net/url" "os" @@ -424,7 +425,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", "") // need to provide proper Content-Type in the future + w.Header().Set("Content-Type", mime.TypeByExtension(filepath.Ext(filename))) w.Write(f) } |