From 2ae00749248ca540719630fa95086ad817262b4d Mon Sep 17 00:00:00 2001 From: phyce Date: Mon, 6 Jul 2026 10:38:38 +0000 Subject: [PATCH] Fix config path lookup for fields with omitempty json tags findFieldByJSONTag compared the full struct tag instead of the name before the comma, so fields tagged json:"x,omitempty" (server, audioCache, ...) could never be resolved by SetValueToPath/ GetValueFromPath, silently breaking config PATCH for those fields. Also fix a malformed json:"engines, omitempty" tag (stray space). Co-Authored-By: Claude Opus 4.8 (1M context) --- app/config/internal.go | 7 ++++++- app/config/structs.go | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/config/internal.go b/app/config/internal.go index d688b79..5cbe705 100644 --- a/app/config/internal.go +++ b/app/config/internal.go @@ -2,6 +2,7 @@ package config import ( "reflect" + "strings" ) func findFieldByJSONTag(dest reflect.Value, jsonTag string) (reflect.Value, bool) { @@ -10,7 +11,11 @@ func findFieldByJSONTag(dest reflect.Value, jsonTag string) (reflect.Value, bool field := dest.Field(i) fieldType := destType.Field(i) tag := fieldType.Tag.Get("json") - if tag == jsonTag { + name := strings.SplitN(tag, ",", 2)[0] + if name == "" || name == "-" { + continue + } + if name == jsonTag { return field, true } } diff --git a/app/config/structs.go b/app/config/structs.go index 38f84e2..e1ffcea 100644 --- a/app/config/structs.go +++ b/app/config/structs.go @@ -34,7 +34,7 @@ type AudioCacheSettings struct { type ServerSettings struct { Auth AuthSettings `json:"auth,omitempty"` - Engines ServerSettingsEngines `json:"engines, omitempty"` + Engines ServerSettingsEngines `json:"engines,omitempty"` } type ServerSettingsEngines struct { Piper map[string]ModelInstances `json:"piper,omitempty"`