Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions util/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,16 @@ func CastValueToKind(value any, kind reflect.Kind) (res any, ok bool) {
res = castStringToBool(fmt.Sprintf("%v", reflect.ValueOf(value)))
ok = true
}
case reflect.Slice:
// Handle string representations of slices, e.g., `["-u semaphore -b"]`
if str, isString := value.(string); isString {
var arr []string
err := json.Unmarshal([]byte(str), &arr)
if err == nil {
res = arr
ok = true
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Slice Unmarshalling Fails for Non-String Types

The CastValueToKind function's reflect.Slice case always unmarshals string representations into a []string. This leads to a type mismatch panic when assigning to configuration fields expecting slices with different element types (e.g., []int, []bool), as reflect.Kind lacks the necessary element type information.

Fix in Cursor Fix in Web

default:
}

Expand Down
Loading