mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-02-26 16:57:08 +00:00
fix: replace wrong SetString() with SetBool() for uint weak-typed input (#2394)
The uint branch in decodeBool() incorrectly used SetString(). Use SetBool(dataVal.Uint() != 0) to match expected behavior.
This commit is contained in:
@@ -289,7 +289,7 @@ func (d *Decoder) decodeBool(name string, data any, val reflect.Value) (err erro
|
||||
case isInt(kind) && d.option.WeaklyTypedInput:
|
||||
val.SetBool(dataVal.Int() != 0)
|
||||
case isUint(kind) && d.option.WeaklyTypedInput:
|
||||
val.SetString(strconv.FormatUint(dataVal.Uint(), 10))
|
||||
val.SetBool(dataVal.Uint() != 0)
|
||||
default:
|
||||
err = fmt.Errorf(
|
||||
"'%s' expected type '%s', got unconvertible type '%s'",
|
||||
|
||||
Reference in New Issue
Block a user