From fa3412d7eabaa753950dd8d724364d9e72857d4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9ra=20Zolt=C3=A1n?= Date: Fri, 15 Jan 2021 15:19:47 +0200 Subject: [PATCH] fix cannot write hidden file without extension (#1017) --- viper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viper.go b/viper.go index d7a3fadad..6c1bcaeaa 100644 --- a/viper.go +++ b/viper.go @@ -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