diff options
author | =Corey Hulen <corey@hulen.com> | 2016-02-23 07:54:51 -0800 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2016-02-23 07:54:51 -0800 |
commit | 5c2100c053d7aea9eec4fd8387951bcae58fe220 (patch) | |
tree | 5a04c5d3ac04eeafd5de7914c4af4b17e0f22c45 | |
parent | e1bcac059db0ea63338465f28b0c8e904d8dc4b8 (diff) | |
download | chat-5c2100c053d7aea9eec4fd8387951bcae58fe220.tar.gz chat-5c2100c053d7aea9eec4fd8387951bcae58fe220.tar.bz2 chat-5c2100c053d7aea9eec4fd8387951bcae58fe220.zip |
Fixing download of apk file
-rw-r--r-- | api/file.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/api/file.go b/api/file.go index 7dcfc691f..5c983ea55 100644 --- a/api/file.go +++ b/api/file.go @@ -419,12 +419,13 @@ func getFile(c *Context, w http.ResponseWriter, r *http.Request) { ua := user_agent.New(r.UserAgent()) bname, _ := ua.Browser() + parts := strings.Split(filename, "/") + filePart := strings.Split(parts[len(parts)-1], "?")[0] + w.Header().Set("Content-Disposition", "attachment;filename=\""+filePart+"\"") + if bname == "Edge" || bname == "Internet Explorer" || bname == "Safari" { // trim off anything before the final / so we just get the file's name - parts := strings.Split(filename, "/") - w.Header().Set("Content-Type", "application/octet-stream") - w.Header().Set("Content-Disposition", "attachment;filename=\""+parts[len(parts)-1]+"\"") } } |