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 committed Nov 5, 2024
1 parent a036786 commit 05e65a5
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 05e65a5

Please sign in to comment.