pull/237/head
Henrique Dias 2017-09-07 11:42:17 +01:00
parent 59b99ee298
commit dd7cd110db
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
1 changed files with 2 additions and 2 deletions

View File

@ -25,7 +25,7 @@ func downloadHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
if r.URL.Query().Get("inline") == "true" { if r.URL.Query().Get("inline") == "true" {
w.Header().Set("Content-Disposition", "inline") w.Header().Set("Content-Disposition", "inline")
} else { } else {
w.Header().Set("Content-Disposition", "attachment; filename="+c.File.Name) w.Header().Set("Content-Disposition", "attachment; filename=\""+c.File.Name+"\"")
} }
http.ServeFile(w, r, c.File.Path) http.ServeFile(w, r, c.File.Path)
@ -107,7 +107,7 @@ func downloadHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
} }
defer file.Close() defer file.Close()
w.Header().Set("Content-Disposition", "attachment; filename="+name) w.Header().Set("Content-Disposition", "attachment; filename=\""+name+"\"")
_, err = io.Copy(w, file) _, err = io.Copy(w, file)
return 0, err return 0, err
} }