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

Inline Partials allow infinite recursion #1069

Open
dpeterson-git opened this issue Jul 21, 2023 · 0 comments
Open

Inline Partials allow infinite recursion #1069

dpeterson-git opened this issue Jul 21, 2023 · 0 comments

Comments

@dpeterson-git
Copy link

In the README.md it states that

By default, Handlebars.java doesn't allow a partial to call itself (directly or indirectly).

This does not seem to be true for inline partials.

new Handlebars().compileInline("{{#*inline \"myPartial\"}}{{> myPartial}}{{/inline}}{{> myPartial}}").apply("");

produces the following exception:

Exception in thread "main" java.lang.StackOverflowError
	at com.github.jknack.handlebars.internal.BaseTemplate.apply(BaseTemplate.java:114)
	at com.github.jknack.handlebars.internal.Partial.merge(Partial.java:148)
	at com.github.jknack.handlebars.internal.BaseTemplate.apply(BaseTemplate.java:126)
	at com.github.jknack.handlebars.internal.TemplateList.merge(TemplateList.java:95)
	at com.github.jknack.handlebars.internal.BaseTemplate.apply(BaseTemplate.java:126)
	at com.github.jknack.handlebars.internal.Partial.merge(Partial.java:228)
	at com.github.jknack.handlebars.internal.BaseTemplate.apply(BaseTemplate.java:126)
	at com.github.jknack.handlebars.internal.TemplateList.merge(TemplateList.java:95)
	at com.github.jknack.handlebars.internal.BaseTemplate.apply(BaseTemplate.java:126)
	at com.github.jknack.handlebars.internal.Partial.merge(Partial.java:228)

Can inline partials also be made subject to the Handlebars.inifiteLoops(true) flag?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant