1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00

Dont recurse into scalar nodes

Fixes https://github.com/mikefarah/yq/issues/375
This commit is contained in:
Mike Farah
2020-02-28 15:01:46 +11:00
parent 8e6ceba2ac
commit b64187fe32
2 changed files with 17 additions and 1 deletions

View File

@@ -4,6 +4,8 @@ import (
"fmt"
"strconv"
"strings"
yaml "gopkg.in/yaml.v3"
)
type PathParser interface {
@@ -45,7 +47,7 @@ func (p *pathParser) MatchesNextPathElement(nodeContext NodeContext, nodeKey str
}
var headString = fmt.Sprintf("%v", head)
if strings.Contains(headString, "==") {
if strings.Contains(headString, "==") && nodeContext.Node.Kind != yaml.ScalarNode {
log.Debug("ooh deep recursion time")
result := strings.SplitN(headString, "==", 2)
path := strings.TrimSpace(result[0])