FileContent: tolerant base64 reader
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
@ -157,11 +158,13 @@ type NetworkDef struct {
|
||||
Script string
|
||||
}
|
||||
|
||||
var b64 = base64.RawStdEncoding
|
||||
|
||||
func (c *Config) FileContent(filePath string) []byte {
|
||||
for _, f := range c.Files {
|
||||
if f.Path == filePath {
|
||||
if f.Content64 != "" {
|
||||
decoded, err := base64.StdEncoding.DecodeString(f.Content64)
|
||||
decoded, err := b64.DecodeString(strings.TrimRight(f.Content64, "="))
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("invalid base64 content in file %s", f.Path))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user