Skip to content

Commit

Permalink
Fixes corredor uint64 conversion
Browse files Browse the repository at this point in the history
- It fixes roundedID issue for WF step corredor automation script executor by adding case for slice of interface in sanitizeMapStringInterface to fix missing ID conversion for it
  • Loading branch information
vicpatel committed Nov 15, 2021
1 parent aced989 commit 3241ff4
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions automation/automation/corredor_handler.go
Expand Up @@ -93,15 +93,26 @@ func (a *scriptArgs) Decode(enc map[string][]byte) (err error) {

// Sanitizing all uint64 values that are encoded into JSON
func sanitizeMapStringInterface(m map[string]interface{}) {
for k := range m {
switch v := m[k].(type) {
var sw func(interface{}) string
sw = func(i interface{}) (s string) {
switch v := i.(type) {
case uint64:
// make sure uint64 values on fields ending with ID
// are properly encoded as strings
m[k] = strconv.FormatUint(v, 10)
s = strconv.FormatUint(v, 10)

case map[string]interface{}:
sanitizeMapStringInterface(v)
case []interface{}:
for _, vv := range i.([]interface{}) {
sw(vv)
}
}
return
}
for k := range m {
if s := sw(m[k]); len(s) > 0 {
m[k] = sw(m[k])
}
}
}

0 comments on commit 3241ff4

Please sign in to comment.