summaryrefslogtreecommitdiffstats
path: root/api/file.go
diff options
context:
space:
mode:
authorJack <jackdeng@gmail.com>2015-09-17 23:11:03 -0700
committerJack <jackdeng@gmail.com>2015-09-17 23:11:03 -0700
commite0a91c0d667f4b6e30c1b5550ab82d31d444890a (patch)
treee57ab361710dad05275981dab73fc2f1e5a67635 /api/file.go
parent82127341cacd4299f9a59e76b5f68d6d7222c45b (diff)
downloadchat-e0a91c0d667f4b6e30c1b5550ab82d31d444890a.tar.gz
chat-e0a91c0d667f4b6e30c1b5550ab82d31d444890a.tar.bz2
chat-e0a91c0d667f4b6e30c1b5550ab82d31d444890a.zip
content type for getFile
Diffstat (limited to 'api/file.go')
-rw-r--r--api/file.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/api/file.go b/api/file.go
index c24775ee2..6806ec185 100644
--- a/api/file.go
+++ b/api/file.go
@@ -28,6 +28,7 @@ import (
"strconv"
"strings"
"time"
+ "mime"
)
var fileInfoCache *utils.Cache = utils.NewLru(1000)
@@ -349,7 +350,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)
}