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

Inconsistent check for Nunjucks disabling flag #3860

Open
FlyingDR opened this issue Nov 14, 2019 · 1 comment
Open

Inconsistent check for Nunjucks disabling flag #3860

FlyingDR opened this issue Nov 14, 2019 · 1 comment

Comments

@FlyingDR
Copy link

@FlyingDR FlyingDR commented Nov 14, 2019

Nunjucks disabling flag check is potentially broken because of inconsistency of logic of passing and checking disableNunjucks parameter from renderers.

As of v4.0.0 disableNunjucks flag is defined by checking corresponding flag from renderer that is received through get() method. This get() method selects between normal and sync stores, but uses normal store by default. However, as can be seen from renderer registration method, this normal store contains Promise and hence provides no access to disableNunjucks flag that can be passed from renderer. Such flag will be stored into storeSync which contains original renderer function.

Correct code for disableNunjucks flag checking should use storeSync:

const disableNunjucks = ext && ctx.render.renderer.get(ext) && !!ctx.render.renderer.get(ext, true).disableNunjucks;

notice second true argument for get().

@curbengh

This comment has been minimized.

Copy link
Contributor

@curbengh curbengh commented Dec 6, 2019

PR welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.