aboutsummaryrefslogtreecommitdiff
path: root/internal/config/skel.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config/skel.go')
-rw-r--r--internal/config/skel.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/internal/config/skel.go b/internal/config/skel.go
index 65d9f95..ca914e3 100644
--- a/internal/config/skel.go
+++ b/internal/config/skel.go
@@ -10,6 +10,7 @@ import (
"io/fs"
"os"
"path/filepath"
+ "unicode/utf8"
"krino/internal/sexp"
"krino/internal/xdg"
@@ -66,6 +67,11 @@ func NewDir(mainFile, name, path string) (string, error) {
if err != nil {
return "", err
}
+ // The path is written into the new file, and config files are UTF-8
+ // text (the reader refuses anything else).
+ if !utf8.ValidString(abs) {
+ return "", fmt.Errorf("%q is not valid UTF-8; krino's config is UTF-8 text, so rename the directory first", abs)
+ }
if fi, err := os.Stat(abs); err != nil || !fi.IsDir() {
return "", fmt.Errorf("%s is not a directory", abs)
}