New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nil pointer outputformat shortcode bug #10391
Comments
Merged
bep
pushed a commit
to davidejones/hugo
that referenced
this issue
Oct 26, 2022
bep
added a commit
to davidejones/hugo
that referenced
this issue
Oct 26, 2022
We do lazy initialization and (potentially) reuse of an output format's rendered content. We do this evaluation when we start a new rendering a new output format. There are, however, situation where these borders gets crossed (e.g. accessing content from another output format). We have a check for this in place for most cases, but not the content rendering of inner markdown blocks inside shortcodes. This patch applies that same logic to the newly introduced RenderContent method (which is not available from the templates). Fixes gohugoio#10391
bep
added a commit
to davidejones/hugo
that referenced
this issue
Oct 26, 2022
We do lazy initialization and (potentially) reuse of an output format's rendered content. We do this evaluation when we start a new rendering a new output format. There are, however, situation where these borders gets crossed (e.g. accessing content from another output format). We have a check for this in place for most cases, but not the content rendering of inner markdown blocks inside shortcodes. This patch applies that same logic to the newly introduced RenderContent method (which is not available from the templates). Fixes gohugoio#10391
bep
pushed a commit
that referenced
this issue
Oct 26, 2022
bep
added a commit
that referenced
this issue
Oct 26, 2022
We do lazy initialization and (potentially) reuse of an output format's rendered content. We do this evaluation when we start a new rendering a new output format. There are, however, situation where these borders gets crossed (e.g. accessing content from another output format). We have a check for this in place for most cases, but not the content rendering of inner markdown blocks inside shortcodes. This patch applies that same logic to the newly introduced RenderContent method (which is not available from the templates). Fixes #10391
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Hugo are you using (hugo version)?
This is confirmed an issue with hugo 101.0 which we are currently using and also with the latest hugo 104.3.
(both extended)
Does this issue reproduce with the latest release?
Yes
What is the issue?
Under a specific set of circumstances a
runtime error: invalid memory address or nil pointer dereference
occursFull Error
View Stack Trace
What specific conditions combine to lead to this error?
.Content
or.Plain
I'm certain these conditions apply because doing any one of these individually causes the problem to be resolved
.Content
or.Plain
in it causes it to workdisableLanguages = ['fr']
causes it to workRecreated Example
TestNestedShortcodeCustomOutputFormat()
Add the following test to hugolib/shortcode_test.go to recreate
Error details
Debugging it seems to be that
cp
onp.pageOutput
is nil at timeshugolib/shortcode.go
For further context our site was working great and we discovered this bug when adding the output format code (which works successfully on other sites of ours)
The text was updated successfully, but these errors were encountered: