From f0748ca139ef5a3faf2b9fd1b13fe73a69543d6c Mon Sep 17 00:00:00 2001 From: Eduardo Minguez Perez Date: Fri, 25 Oct 2019 16:07:07 +0200 Subject: [PATCH] Added verify base64 is not empty --- file-to-machineconfig.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/file-to-machineconfig.go b/file-to-machineconfig.go index 97b781f..1d629d3 100644 --- a/file-to-machineconfig.go +++ b/file-to-machineconfig.go @@ -46,7 +46,11 @@ func fileToBase64(file string) string { if err != nil { log.Fatal(err) } - return b64.StdEncoding.EncodeToString([]byte(f)) + encodedcontent := b64.StdEncoding.EncodeToString([]byte(f)) + if encodedcontent == "" { + log.Fatal("The content of the file couldn't be encoded in base64") + } + return encodedcontent } func labelsToMap(labels string) map[string]string {