Fixed base64 decode an empty string #1209

This commit is contained in:
Mike Farah 2022-05-27 10:56:43 +10:00
parent 1e27e39927
commit 8d32e6a82c
2 changed files with 8 additions and 1 deletions

View File

@ -35,7 +35,6 @@ func (dec *base64Decoder) Decode(rootYamlNode *yaml.Node) error {
} }
if buf.Len() == 0 { if buf.Len() == 0 {
dec.finished = true dec.finished = true
return io.EOF
} }
rootYamlNode.Kind = yaml.ScalarNode rootYamlNode.Kind = yaml.ScalarNode
rootYamlNode.Tag = "!!str" rootYamlNode.Tag = "!!str"

View File

@ -243,6 +243,14 @@ var encoderDecoderOperatorScenarios = []expressionScenario{
"D0, P[], (doc)::coolData:\n a: apple\n", "D0, P[], (doc)::coolData:\n a: apple\n",
}, },
}, },
{
description: "empty base64 decode",
skipDoc: true,
expression: `"" | @base64d`,
expected: []string{
"D0, P[], (!!str)::\n",
},
},
} }
func TestEncoderDecoderOperatorScenarios(t *testing.T) { func TestEncoderDecoderOperatorScenarios(t *testing.T) {