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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user