From 8f88ea76a68bc38f334b3dc9e29e7bb5dc552a1b Mon Sep 17 00:00:00 2001 From: Thulio Assis Date: Fri, 19 Oct 2018 13:47:18 -0700 Subject: [PATCH] Fixed unmarshalReader not returning error when the input io.Reader returns an error --- viper.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/viper.go b/viper.go index a32ab73..e275675 100644 --- a/viper.go +++ b/viper.go @@ -1329,7 +1329,9 @@ func unmarshalReader(in io.Reader, c map[string]interface{}) error { } func (v *Viper) unmarshalReader(in io.Reader, c map[string]interface{}) error { buf := new(bytes.Buffer) - buf.ReadFrom(in) + if _, err := buf.ReadFrom(in); err != nil { + return ConfigParseError{err} + } switch strings.ToLower(v.getConfigType()) { case "yaml", "yml":