Browse Source

Fix safeString() escaping

Vadim Markovtsev 7 years ago
parent
commit
30aadd18ec
1 changed files with 3 additions and 4 deletions
  1. 3 4
      cmd/hercules/main.go

+ 3 - 4
cmd/hercules/main.go

@@ -27,9 +27,8 @@ import (
 )
 
 func safeString(str string) string {
-	str = strings.Replace(str, "\"", "'", -1)
-	str = strings.Replace(str, "\\", " ", -1)
-	str = strings.Replace(str, ":", " ", -1)
+	str = strings.Replace(str, "\\", "\\\\", -1)
+	str = strings.Replace(str, "\"", "\\\"", -1)
 	return "\"" + str + "\""
 }
 
@@ -319,7 +318,7 @@ func main() {
 	if with_people {
 		fmt.Println("people_sequence:")
 		for key := range burndown_results.PeopleHistories {
-			fmt.Println("  - " + id_matcher.ReversePeopleDict[key])
+			fmt.Println("  - " + safeString(id_matcher.ReversePeopleDict[key]))
 		}
 		fmt.Println("people:")
 		for key, val := range burndown_results.PeopleHistories {