diff --git a/check.go b/check.go index 4e78848..aea68fd 100644 --- a/check.go +++ b/check.go @@ -28,8 +28,10 @@ func (de DecortClient) Check() (*CheckInfo, error) { err = json.Unmarshal([]byte(strings.Replace(strings.Trim(string(res), `"`), "\\", "", -1)), &info) if err != nil { - if _, exists := constants.VersionMap[string(res)]; exists { - info.Version = string(res) + var v string + json.Unmarshal([]byte(res), &v) + if _, exists := constants.VersionMap[v]; exists { + info.Version = v } else { return nil, fmt.Errorf("platform version isn't supported") } @@ -55,7 +57,13 @@ func (bvs BVSDecortClient) Check() (*CheckInfo, error) { err = json.Unmarshal([]byte(strings.Replace(strings.Trim(string(res), `"`), "\\", "", -1)), &info) if err != nil { - return nil, err + var v string + json.Unmarshal([]byte(res), &v) + if _, exists := constants.VersionMap[v]; exists { + info.Version = v + } else { + return nil, fmt.Errorf("platform version isn't supported") + } } if v, ok := constants.VersionMap[info.Version]; ok { @@ -78,7 +86,13 @@ func (ldc LegacyDecortClient) Check() (*CheckInfo, error) { err = json.Unmarshal([]byte(strings.Replace(strings.Trim(string(res), `"`), "\\", "", -1)), &info) if err != nil { - return nil, err + var v string + json.Unmarshal([]byte(res), &v) + if _, exists := constants.VersionMap[v]; exists { + info.Version = v + } else { + return nil, fmt.Errorf("platform version isn't supported") + } } if v, ok := constants.VersionMap[info.Version]; ok {