cli: make bool parsing case-sensitive
Completes the boolean fix: only literal "true"/"false" are accepted, with no case folding, so "True"/"TRUE" are rejected. Drop strings.ToLower. Keep TrimSpace so a config value with surrounding whitespace still parses; only the case folding was invented leniency.
This commit is contained in:
@@ -38,8 +38,11 @@ var boolWords = map[string]bool{
|
||||
}
|
||||
|
||||
// boolWord reports a value's truth and whether it is a recognised boolean word.
|
||||
// Whitespace is trimmed (aria2 strips config values too), but case is
|
||||
// significant: aria2 rejects "True"/"TRUE", so the match is against exactly
|
||||
// "true"/"false".
|
||||
func boolWord(s string) (val, ok bool) {
|
||||
val, ok = boolWords[strings.ToLower(strings.TrimSpace(s))]
|
||||
val, ok = boolWords[strings.TrimSpace(s)]
|
||||
return val, ok
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user