M faceit.go => faceit.go +1 -3
@@ 366,7 366,6 @@ func (fc *faceitChecker) faceitHandler(w http.ResponseWriter, r *http.Request) {
fc.logger.Errorf("faceitHandler: failed to parse SteamID (%s): %v", steamID, err)
continue
}
- // TODO: sanitize name
steamAccountList = append(steamAccountList, fmt.Sprintf("%s_%s", id64, nickname))
}
} else {
@@ 380,8 379,7 @@ func (fc *faceitChecker) faceitHandler(w http.ResponseWriter, r *http.Request) {
}
return
}
- // TODO: sanitize name
- steamAccountList = append(steamAccountList, fmt.Sprintf("%s_%s", steamProfile.ID64, steamProfile.Name))
+ steamAccountList = append(steamAccountList, fmt.Sprintf("%s_%s", steamProfile.ID64, sanitizeName(steamProfile.Name)))
}
}
M steam.go => steam.go +5 -1
@@ 55,8 55,12 @@ func parseStatus(status string) (map[string]string, error) {
if len(match) != 3 {
continue
}
- players[match[2]] = match[1]
+ players[match[2]] = sanitizeName(match[1])
}
return players, nil
}
+
+func sanitizeName(name string) string {
+ return strings.ReplaceAll(name, " ", "")
+}