diff --git a/pkg/yqlib/operator_strings.go b/pkg/yqlib/operator_strings.go index 133b55f9..c9bb9e4a 100644 --- a/pkg/yqlib/operator_strings.go +++ b/pkg/yqlib/operator_strings.go @@ -102,7 +102,8 @@ func interpolate(d *dataTreeNavigator, context Context, str string) (string, err } } if inExpression { - return "", fmt.Errorf("unclosed interpolation string \\(") + log.Warning("unclosed interpolation string, skipping interpolation") + return str, nil } return sb.String(), nil } diff --git a/pkg/yqlib/operator_strings_test.go b/pkg/yqlib/operator_strings_test.go index 4b68deb3..bbcbc483 100644 --- a/pkg/yqlib/operator_strings_test.go +++ b/pkg/yqlib/operator_strings_test.go @@ -66,18 +66,22 @@ var stringsOperatorScenarios = []expressionScenario{ }, }, { - skipDoc: true, - description: "Interpolation - unclosed interpolation string", - document: `value: things`, - expression: `"Hi \("`, - expectedError: "unclosed interpolation string \\(", + skipDoc: true, + description: "Interpolation - unclosed interpolation string", + document: `value: things`, + expression: `"Hi \("`, + expected: []string{ + "D0, P[], (!!str)::Hi \\(\n", + }, }, { - skipDoc: true, - description: "Interpolation - unclosed interpolation string due to escape", - document: `value: things`, - expression: `"Hi \(\)"`, - expectedError: "unclosed interpolation string \\(", + skipDoc: true, + description: "Interpolation - unclosed interpolation string due to escape", + document: `value: things`, + expression: `"Hi \(\)"`, + expected: []string{ + "D0, P[], (!!str)::Hi \\(\\)\n", + }, }, { description: "To up (upper) case",