fix: handle empty config values in getRepoConfig() (GH#680)

GetConfig() returns ("", nil) for missing/empty config keys.
getRepoConfig() then tried json.Unmarshal([]byte(""), ...) which
fails with "unexpected end of JSON input".

Add empty value check before JSON parsing - return empty map when
config value is empty string.

Closes GH#680

Co-Authored-By: dylan-conlin <dylan-conlin@users.noreply.github.com>
This commit is contained in:
Steve Yegge
2025-12-21 21:08:12 -08:00
parent 310e86d1d9
commit d39e868199
2 changed files with 114 additions and 0 deletions

View File

@@ -196,6 +196,11 @@ func getRepoConfig(ctx context.Context, store storage.Storage) (map[string]strin
return nil, err
}
// Handle empty value (config key exists but no value set)
if value == "" {
return make(map[string]string), nil
}
// Parse JSON map
repos := make(map[string]string)
if err := json.Unmarshal([]byte(value), &repos); err != nil {