Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-10-25 13:28:12 +0300
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-10-25 20:50:18 +0300
commit75c9b893d98961a504cff9ed3c89055d16e315d6 (patch)
tree0cc8508ff66ebaccb00cd2fc60313591e0be0a43 /create/content.go
parent64e1613fb390bd893900dc0596e5c3f3c8e1cd8c (diff)
create: Validate the target path in hugo new
Fixes #9072
Diffstat (limited to 'create/content.go')
-rw-r--r--create/content.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/create/content.go b/create/content.go
index 914c16bec..eb0658604 100644
--- a/create/content.go
+++ b/create/content.go
@@ -91,6 +91,10 @@ func NewContent(h *hugolib.HugoSites, kind, targetPath string) error {
return errors.Errorf("failed to resolve %q to a archetype template", targetPath)
}
+ if !files.IsContentFile(b.targetPath) {
+ return errors.Errorf("target path %q is not a kown content format", b.targetPath)
+ }
+
return b.buildFile()
}