diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-02-23 12:25:48 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-02-23 12:25:48 -0500 |
commit | eac022e75a2068d0553b523456dc0ee1e6f941a7 (patch) | |
tree | 5a04c5d3ac04eeafd5de7914c4af4b17e0f22c45 | |
parent | e1bcac059db0ea63338465f28b0c8e904d8dc4b8 (diff) | |
parent | 5c2100c053d7aea9eec4fd8387951bcae58fe220 (diff) | |
download | chat-eac022e75a2068d0553b523456dc0ee1e6f941a7.tar.gz chat-eac022e75a2068d0553b523456dc0ee1e6f941a7.tar.bz2 chat-eac022e75a2068d0553b523456dc0ee1e6f941a7.zip |
Merge pull request #2227 from mattermost/fix-apk
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]+"\"") } } |