Skip to content

Commit

Permalink
Fix incorrect slice/array typed value casting
Browse files Browse the repository at this point in the history
  • Loading branch information
tjerman authored and Fajfa committed Nov 5, 2024
1 parent 563b7dd commit eb51407
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions server/pkg/expr/expr_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,15 @@ func Typify(in interface{}) (tv TypedValue, err error) {
case io.Reader, io.ReadCloser, io.ReadSeeker, io.ReadSeekCloser, io.ReadWriteSeeker:
return &Reader{value: c.(io.Reader)}, nil
default:
// In case this is a slice/array
switch reflect.TypeOf(c).Kind() {
case reflect.Slice:
return NewArray(c)
case reflect.Array:
return NewArray(c)
}

// If all else fails
return &Any{value: c}, nil
}
}
Expand Down

0 comments on commit eb51407

Please sign in to comment.