FileContent: tolerant base64 reader
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
@ -9,6 +8,8 @@ import (
|
||||
"time"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
"novit.tech/direktil/pkg/base64"
|
||||
)
|
||||
|
||||
// Load a config from a file.
|
||||
@ -161,7 +162,7 @@ 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 := base64.Decode(f.Content64)
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("invalid base64 content in file %s", f.Path))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user