]> git.maquefel.me Git - brevno-suite/hugo/commit
create: Return error instead of panic when page not found
authoreason <85663565+mango766@users.noreply.github.com>
Mon, 23 Mar 2026 16:50:15 +0000 (00:50 +0800)
committerGitHub <noreply@github.com>
Mon, 23 Mar 2026 16:50:15 +0000 (17:50 +0100)
commit807cae1df11cc83edadcdad29ed762870b5d48fa
tree25b5b9ec829f1a4b7a16751a021bcaa461f36f4f
parentc4fb61d9dfb7a2a638ef69ef8ba4e4dc3ecd93ef
create: Return error instead of panic when page not found

When `hugo new` creates a content file on a case-insensitive filesystem
where a file with the same name but different case already exists (e.g.
Floop.md vs floop.md), the internal page lookup fails because it uses
exact string comparison. This previously caused an unhelpful panic.

Replace the panic with a descriptive error message that tells the user
what went wrong and suggests checking for case-variant filenames.

Fixes #14112

Co-authored-by: easonysliu <easonysliu@tencent.com>
Co-authored-by: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
create/content.go