(fix/http) replace space with _

pull/10616/head
Kelvin Wang 2018-10-31 14:45:28 -04:00
parent 434c2bd052
commit d218892be0
1 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"strings"
"time"
"github.com/influxdata/platform"
@ -144,7 +145,7 @@ func (h *TelegrafHandler) handleGetTelegraf(w http.ResponseWriter, r *http.Reque
switch contentType {
case "application/octet-stream":
w.Header().Set("Content-Type", "application/octet-stream")
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s.toml\"", tc.Name))
w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s.toml\"", strings.Replace(strings.TrimSpace(tc.Name), " ", "_", -1)))
w.WriteHeader(http.StatusOK)
w.Write([]byte(tc.TOML()))
case "application/toml":