Skip to content

Commit bcd6c81

Browse files
JoeKardmaluka
andcommitted
settings: Don't return maps with ParsedSettings()
Map-typed values in the parsedSettings map do not represent settings for individual options, they represent maps of settings for multiple options for the given glob or ft: pattern, and their keys are not option names, they are glob and ft: patterns. So do not expose them to the callers of ParsedSettings(), to prevent the callers from mistakenly treating those patterns as option names, with unpredicted consequences. Co-authored-by: Dmytro Maluka <dmitrymaluka@gmail.com>
1 parent 42d0ddf commit bcd6c81

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

internal/config/settings.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ func ReadSettings() error {
256256
func ParsedSettings() map[string]any {
257257
s := make(map[string]any)
258258
for k, v := range parsedSettings {
259+
if strings.HasPrefix(reflect.TypeOf(v).String(), "map") {
260+
continue
261+
}
259262
s[k] = v
260263
}
261264
return s

0 commit comments

Comments
 (0)