diff options
author | Florian Orben <florian.orben@gmail.com> | 2015-10-17 01:58:34 +0200 |
---|---|---|
committer | Florian Orben <florian.orben@gmail.com> | 2015-10-21 18:13:59 +0200 |
commit | d167e18f0048344c54685a08c19113a84a995ed9 (patch) | |
tree | ccab4d40fc13d8ee566c81774e123f526a879b9a /api/file.go | |
parent | 9553e44dc55e1798180a942e774e9b11f8b01d67 (diff) | |
download | chat-d167e18f0048344c54685a08c19113a84a995ed9.tar.gz chat-d167e18f0048344c54685a08c19113a84a995ed9.tar.bz2 chat-d167e18f0048344c54685a08c19113a84a995ed9.zip |
PLT-616: Enable playing of animated GIF in thumbnails and preview
Diffstat (limited to 'api/file.go')
-rw-r--r-- | api/file.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/api/file.go b/api/file.go index 142ef7ac7..94eea516a 100644 --- a/api/file.go +++ b/api/file.go @@ -23,6 +23,7 @@ import ( "image/jpeg" "io" "io/ioutil" + "mime" "net/http" "net/url" "os" @@ -331,9 +332,18 @@ func getFileInfo(c *Context, w http.ResponseWriter, r *http.Request) { w.Header().Set("Cache-Control", "max-age=2592000, public") + var mimeType string + ext := filepath.Ext(filename) + if model.IsFileExtImage(ext) { + mimeType = model.GetImageMimeType(ext) + } else { + mimeType = mime.TypeByExtension(ext) + } + result := make(map[string]string) result["filename"] = filename result["size"] = size + result["mime"] = mimeType w.Write([]byte(model.MapToJson(result))) } |