From 5c2100c053d7aea9eec4fd8387951bcae58fe220 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 23 Feb 2016 07:54:51 -0800 Subject: Fixing download of apk file --- api/file.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'api') 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]+"\"") } } -- cgit v1.2.3-1-g7c22