mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
event/cmdschema: make boolean parsing stricter
This commit is contained in:
parent
d63a008ec6
commit
60be954407
1 changed files with 3 additions and 3 deletions
|
|
@ -331,10 +331,10 @@ func parseBoolean(val string) (bool, error) {
|
|||
if len(val) == 0 {
|
||||
return false, fmt.Errorf("cannot parse empty string as boolean")
|
||||
}
|
||||
switch val[0] {
|
||||
case 't', 'T', 'y', 'Y', '1':
|
||||
switch strings.ToLower(val) {
|
||||
case "t", "true", "y", "yes", "1":
|
||||
return true, nil
|
||||
case 'f', 'F', 'n', 'N', '0':
|
||||
case "f", "false", "n", "no", "0":
|
||||
return false, nil
|
||||
default:
|
||||
return false, fmt.Errorf("invalid boolean string: %q", val)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue