Skip to content

Commit

Permalink
Added verify base64 is not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
e-minguez committed Oct 25, 2019
1 parent 4169e96 commit f0748ca
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion file-to-machineconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit f0748ca

Please sign in to comment.