1
1
mirror of https://github.com/wader/fq.git synced 2024-08-16 23:40:43 +03:00

interp: Fix infinite recursion when casting synthetic raw value into a jq value

This commit is contained in:
Mattias Wadman 2023-10-29 16:06:49 +01:00
parent 4783e52d78
commit 29e75411ed
2 changed files with 9 additions and 4 deletions

View File

@ -89,6 +89,8 @@ func ToGoJQValueFn(v any, valueFn func(v any) (any, error)) (any, error) {
vvs[k] = v
}
return vvs, nil
case error:
return nil, vv
default:
nv, err := valueFn(vv)
if err != nil {

View File

@ -634,12 +634,15 @@ func (v decodeValue) JQValueToGoJQEx(optsFn func() (*Options, error)) any {
return v.JQValueToGoJQ()
}
bv, err := v.decodeValueBase.ToBinary()
if err != nil {
return err
if s, ok := v.dv.V.(scalar.Scalarable); ok && !s.ScalarFlags().IsSynthetic() {
bv, err := v.ToBinary()
if err != nil {
return err
}
return bv.JQValueToGoJQEx(optsFn)
}
return bv.JQValueToGoJQEx(optsFn)
return v.JQValueToGoJQ()
}