diff options
author | Jakob Unterwurzacher | 2018-09-08 12:18:26 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2018-09-08 12:18:26 +0200 |
commit | 21eaa8f164cba9fe6032a6a15de0c51ae1a16f8b (patch) | |
tree | 07f2f9bae490fdf716a798a1d78d126eea4b783b /internal | |
parent | 22906cc5faa5310c5dd0e6bb37f3acbbe4b93081 (diff) |
configfile: return specific error on empty input
Report the actual problem instead of a generic
"unexpected end of JSON input".
https://github.com/rfjakob/gocryptfs/issues/258
Diffstat (limited to 'internal')
-rw-r--r-- | internal/configfile/config_file.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/configfile/config_file.go b/internal/configfile/config_file.go index 4edf99d..31646ef 100644 --- a/internal/configfile/config_file.go +++ b/internal/configfile/config_file.go @@ -133,6 +133,9 @@ func Load(filename string, password []byte) ([]byte, *ConfFile, error) { if err != nil { return nil, nil, err } + if len(js) == 0 { + return nil, nil, fmt.Errorf("Config file is empty") + } // Unmarshal err = json.Unmarshal(js, &cf) |