]> git.maquefel.me Git - brevno-suite/hugo/commit
tpl: Fix partial decorator panic when partial returns falsy
authorSimon Heimlicher <simon.github@heimlicher.com>
Sat, 24 Jan 2026 15:59:18 +0000 (16:59 +0100)
committerGitHub <noreply@github.com>
Sat, 24 Jan 2026 15:59:18 +0000 (16:59 +0100)
commitf472dd48a7dc3ae0304871eef785b00b9ead8160
tree63e516c98f2befae11dec96c495a70a8ee20c9c1
parent50973e727223b346fa1113d8a79e9b1539cd4e59
tpl: Fix partial decorator panic when partial returns falsy

When {{ with partial "foo" }} returns a falsy value (false, nil, ""),
the with block is skipped but _popPartialDecorator was only called
inside the with block. This left an orphan entry on the decorator
stack, causing "partial decorator ID mismatch" panic on subsequent
partial calls.

Add _popPartialDecorator call to the else branch to ensure the
decorator stack is always balanced regardless of the partial's
return value.

Fixes #14419
tpl/templates/decorator_falsy_test.go [new file with mode: 0644]
tpl/tplimpl/templatetransform.go