mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-19 14:30:38 -07:00
fix: enforce renderLimit for empty renderTemplates calls
renderLimit was only checked inside the per-template loop, so
renderTemplates([], ...) skipped it entirely. Empty {% for %} / {% tablerow %}
bodies invoke that path once per iteration, bypassing the documented time
budget. Check the limiter at renderTemplates entry before the loop.
Add regression test for empty for-body with a strict renderLimit.
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -15,6 +15,7 @@ export class Render {
|
||||
if (!emitter) {
|
||||
emitter = ctx.opts.keepOutputType ? new KeepingTypeEmitter() : new SimpleEmitter()
|
||||
}
|
||||
ctx.renderLimit.check(getPerformance().now())
|
||||
const errors = []
|
||||
for (const tpl of templates) {
|
||||
ctx.renderLimit.check(getPerformance().now())
|
||||
|
||||
Reference in New Issue
Block a user