Commit 10ca1c17 authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Convert custom SQL query and exec parameters to integers where appropriate.

parent b73a75e7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
- Listing user groups no longer returns an error when the user is a member of zero groups.
- Go runtime group creation now correctly validates max count.
- Consistent expiry calculation in leaderboard records haystack queries.
- Convert custom SQL query and exec parameters to integers where appropriate.

## [2.6.0] - 2019-07-01
### Added
+12 −0
Original line number Diff line number Diff line
@@ -304,6 +304,12 @@ func applyWalletUpdate(wallet map[string]interface{}, changeset map[string]inter
						return nil, fmt.Errorf("wallet update rejected negative value at path '%v'", currentPath)
					}
					wallet[k] = newValue
				} else if changesetValue, ok := v.(int64); ok {
					newValue := existingValue + float64(changesetValue)
					if newValue < 0 {
						return nil, fmt.Errorf("wallet update rejected negative value at path '%v'", currentPath)
					}
					wallet[k] = newValue
				} else {
					return nil, fmt.Errorf("update changeset does not match existing wallet value number type at path '%v'", currentPath)
				}
@@ -325,6 +331,12 @@ func applyWalletUpdate(wallet map[string]interface{}, changeset map[string]inter
					return nil, fmt.Errorf("wallet update rejected negative value at path '%v'", currentPath)
				}
				wallet[k] = changesetValue
			} else if changesetValue, ok := v.(int64); ok {
				if changesetValue < 0 {
					// Do not allow setting negative initial values.
					return nil, fmt.Errorf("wallet update rejected negative value at path '%v'", currentPath)
				}
				wallet[k] = float64(changesetValue)
			} else {
				// Incoming value is not a map or float.
				return nil, fmt.Errorf("unknown update changeset value type at path '%v', expecting map or float64", currentPath)
+7 −1
Original line number Diff line number Diff line
@@ -171,7 +171,13 @@ func RuntimeLuaConvertLuaValue(lv lua.LValue) interface{} {
	case lua.LString:
		return string(v)
	case lua.LNumber:
		return float64(v)
		vf := float64(v)
		vi := int64(v)
		if vf == float64(vi) {
			// If it's a whole number use an actual integer type.
			return vi
		}
		return vf
	case *lua.LTable:
		maxn := v.MaxN()
		if maxn == 0 {