Inline Partials allow infinite recursion
dpeterson-git opened this issue · 0 comments
dpeterson-git commented
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?