fix cannot write hidden file without extension (#1017)

This commit is contained in:
Séra Zoltán 2021-01-15 15:19:47 +02:00 committed by Márk Sági-Kazár
parent a1f26b11bd
commit fa3412d7ea

View file

@ -1581,7 +1581,7 @@ func (v *Viper) writeConfig(filename string, force bool) error {
var configType string
ext := filepath.Ext(filename)
if ext != "" {
if ext != "" && ext != filepath.Base(filename) {
configType = ext[1:]
} else {
configType = v.configType