More changes
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 23s
All checks were successful
Golan Testing / testing (1.24.x, ubuntu-latest) (push) Successful in 23s
This commit is contained in:
11
vehicle.go
11
vehicle.go
@ -497,14 +497,13 @@ func (v *Vehicle) GetClimatePresets() {
|
|||||||
}
|
}
|
||||||
v.client.logger.Debug("subaru climate presets parsed http output", "body", string(tmp.Data))
|
v.client.logger.Debug("subaru climate presets parsed http output", "body", string(tmp.Data))
|
||||||
|
|
||||||
unescapedJSON, err := strconv.Unquote(string(tmp.Data))
|
re1 := regexp.MustCompile(`([\\]["])`)
|
||||||
if err != nil {
|
result := re1.ReplaceAllString(string(tmp.Data), "")
|
||||||
fmt.Println("Error unquoting:", err)
|
re2 := regexp.MustCompile(`([\\\\])`)
|
||||||
return
|
result = re2.ReplaceAllString(result, "")
|
||||||
}
|
|
||||||
|
|
||||||
var cProfiles []ClimateProfile
|
var cProfiles []ClimateProfile
|
||||||
err = json.Unmarshal([]byte(unescapedJSON), &cProfiles)
|
err = json.Unmarshal([]byte(result), &cProfiles)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
v.client.logger.Error("error while parsing json", "request", "GetClimatePresets", "error", err.Error())
|
v.client.logger.Error("error while parsing json", "request", "GetClimatePresets", "error", err.Error())
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user