Add filename + download disposition for when downloading config

This commit is contained in:
Daniel Lundin
2019-10-02 19:22:57 +02:00
parent a584e942eb
commit 2eab0cea18
+2
View File
@@ -419,6 +419,8 @@ func (s *Server) GetClient(w http.ResponseWriter, r *http.Request, ps httprouter
format := r.URL.Query().Get("format")
if format == "config" {
filename := fmt.Sprintf("%s.conf", client.Name)
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", filename))
w.WriteHeader(http.StatusOK)
allowedIPs := strings.Join(*wgAllowedIPs, ",")