fix(properties): parse int64 correctly

resolves #2334
This commit is contained in:
Jan De Dobbeleer 2022-05-27 10:23:09 +02:00 committed by Jan De Dobbeleer
parent 2ea6198a13
commit e41304ae44

View file

@ -116,17 +116,20 @@ func (m Map) GetInt(property Property, defaultValue int) int {
return defaultValue return defaultValue
} }
if intValue, ok := val.(int); ok { switch v := val.(type) {
return intValue case int:
} return v
case int64:
// config parser parses a float return int(v)
intValue, ok := val.(float64) case float64:
if !ok { intValue, ok := val.(float64)
if !ok {
return defaultValue
}
return int(intValue)
default:
return defaultValue return defaultValue
} }
return int(intValue)
} }
func (m Map) GetKeyValueMap(property Property, defaultValue map[string]string) map[string]string { func (m Map) GetKeyValueMap(property Property, defaultValue map[string]string) map[string]string {