Skip to content

Commit 8d32e6a

Browse files
committed
Fixed base64 decode an empty string #1209
1 parent 1e27e39 commit 8d32e6a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

pkg/yqlib/decoder_base64.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ func (dec *base64Decoder) Decode(rootYamlNode *yaml.Node) error {
3535
}
3636
if buf.Len() == 0 {
3737
dec.finished = true
38-
return io.EOF
3938
}
4039
rootYamlNode.Kind = yaml.ScalarNode
4140
rootYamlNode.Tag = "!!str"

pkg/yqlib/operator_encoder_decoder_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,14 @@ var encoderDecoderOperatorScenarios = []expressionScenario{
243243
"D0, P[], (doc)::coolData:\n a: apple\n",
244244
},
245245
},
246+
{
247+
description: "empty base64 decode",
248+
skipDoc: true,
249+
expression: `"" | @base64d`,
250+
expected: []string{
251+
"D0, P[], (!!str)::\n",
252+
},
253+
},
246254
}
247255

248256
func TestEncoderDecoderOperatorScenarios(t *testing.T) {

0 commit comments

Comments
 (0)