create: Validate the target path in hugo new

Fixes #9072
This commit is contained in:
Bjørn Erik Pedersen
2021-10-25 12:28:12 +02:00
parent 64e1613fb3
commit 75c9b893d9
2 changed files with 18 additions and 3 deletions

View File

@@ -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()
}