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:
2026-06-21 15:52:42 +09:00
parent 10672f3816
commit 6c045999f2
2 changed files with 10 additions and 5 deletions

View File

@@ -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
}