mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: return empty array if no option multi-selected (#19224)
Related: https://github.com/coder/coder/issues/19145
This commit is contained in:
+5
-1
@@ -349,7 +349,11 @@ func RichMultiSelect(inv *serpent.Invocation, richOptions RichMultiSelectOptions
|
||||
}
|
||||
|
||||
// Check selected option, convert descriptions (line) to values
|
||||
var results []string
|
||||
//
|
||||
// The function must return an initialized empty array, since it is later marshaled
|
||||
// into JSON. Otherwise, `var results []string` would be marshaled to "null".
|
||||
// See: https://github.com/golang/go/issues/27589
|
||||
results := []string{}
|
||||
for _, sel := range selected {
|
||||
custom := true
|
||||
for i, option := range richOptions.Options {
|
||||
|
||||
Reference in New Issue
Block a user