diff --git a/modules/router/router.go b/modules/router/router.go index c8aa06c..7f4a1df 100644 --- a/modules/router/router.go +++ b/modules/router/router.go @@ -848,12 +848,14 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) { for i := 0; i < s.Len(); i++ { ss = ss + fmt.Sprintf(" %v,", s.Index(i)) } - f.WriteString(fmt.Sprintf("%s;", ss)) + ss = strings.Replace(ss, "\n", "", -1) + ss = strings.Replace(ss, "\"", "\"\"", -1) + f.WriteString(fmt.Sprintf(`"%s";`, ss)) } case reflect.String: { - f.WriteString(fmt.Sprintf("%v;", strings.Replace(data.(string), "\n", "", -1))) + f.WriteString(fmt.Sprintf(`"%v";`, strings.Replace(strings.Replace(data.(string), "\n", "", -1), "\"", "\"\"", -1))) } default: { @@ -917,12 +919,13 @@ func (rt *Router) ApiHandler(w http.ResponseWriter, r *http.Request) { for i := 0; i < s.Len(); i++ { ss = ss + fmt.Sprintf(" %v,", s.Index(i)) } - f.WriteString(fmt.Sprintf("%s;", ss)) - + ss = strings.Replace(ss, "\n", "", -1) + ss = strings.Replace(ss, "\"", "\"\"", -1) + f.WriteString(fmt.Sprintf(`"%s";`, ss)) } case reflect.String: { - f.WriteString(fmt.Sprintf("%v;", strings.Replace(data.(string), "\n", "", -1))) + f.WriteString(fmt.Sprintf(`"%v";`, strings.Replace(strings.Replace(data.(string), "\n", "", -1), "\"", "\"\"", -1))) } default: { diff --git a/modules/version/version.go b/modules/version/version.go index 09481e9..0cfbe33 100644 --- a/modules/version/version.go +++ b/modules/version/version.go @@ -13,4 +13,4 @@ package version -var Version = "extractor/v0.2.8" +var Version = "extractor/v0.2.9"