Skip to content
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

Using method jsonify on the "Dot" inside a range .Pages errors in a stack overflow #8448

Closed
erik06 opened this issue Apr 20, 2021 · 7 comments

Comments

@erik06
Copy link

erik06 commented Apr 20, 2021

hugo version v0.82.1+extended darwin/amd64

Does this issue reproduce with the latest release?

Yes

Error replication

layouts/_default/list.html

{{ define "main" }}
  {{ range .Pages }}
    {{ . | jsonify }}
  {{ end }}
{{ end }}

This fails and crashes in a stack overflow.

@bep bep added the Upstream label Apr 20, 2021
@bep bep added this to the v0.83 milestone Apr 20, 2021
@bep bep added the Bug label Apr 20, 2021
@bep
Copy link
Member

bep commented Apr 20, 2021

So, this is effectively golang/go#10769
golang/go#40745

I did some work on limiting the JSON output from Page and Site to prevent/limit this, but as you found out, there still is possible to end up in a cycle.

My current recommendation would be to not use ´jsonifyfor the entirePageobject -- if you need JSON, create a new data structure withdict´ with the fields you want, then use jsonify on that.

@erik06
Copy link
Author

erik06 commented Apr 21, 2021

Thank you for this reply. I was looking to utilize some maybe lesser known data to show on my shiny new custom list page, and was curious what all was available for me. Curiosity, it seems, lead to my computer to becoming a new (intel) cookware device.

I'll take a look at the Page object. I'm not blocked by not having jsonify. Many thanks for your hard work!

@bep
Copy link
Member

bep commented Apr 21, 2021

I notice that we do have a test for this -- if your site source is available online, I would love to have a look.

@erik06
Copy link
Author

erik06 commented Apr 21, 2021

The code I'm working on it currently closed source and internal. Would it be helpful if I spun something up new to recreate the issue?

@bep bep modified the milestones: v0.83, v0.84 May 1, 2021
@bep bep modified the milestones: v0.84, v0.85 Jun 18, 2021
@bep bep modified the milestones: v0.85, v0.86 Jul 5, 2021
@bep bep modified the milestones: v0.86, v0.87, v0.88 Jul 26, 2021
@bep bep modified the milestones: v0.88, v0.89 Sep 2, 2021
@jmooring
Copy link
Member

@erik06 I am unable to reproduce this. Please provide a minimal reproducible example, or close the issue. Thanks.

@erik06
Copy link
Author

erik06 commented Oct 22, 2021

I think I misunderstood the context that I was in when trying this out. I will close this ticket.

@erik06 erik06 closed this as completed Oct 22, 2021
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants