You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
As of #669 we have a conditional check ({{if foo="bar}}). #1128 introduced a != notation too.
The portion of code that does the actual parsing looks like this:
if(matched.attributes?.includes("=")){
The problem with this is that if the matched attribute value contains a "=" (which can happen if it's e.g. a URL with query params) the code above will evaluate to true, we will split the string (URL in our example) in half and try to do an equality check which, naturally, will fail.
Short-term solution
Try to determine if a attribute is an URL. If so, don't do the conditional check, use only length check. **In practical terms, this would mean that if a string looks like an URL, it will be impossible to compare its value, e.g. no {{if {url}=https://www.example.com}}}. If url has a value, the check will evaluate to true, always.
Describe the bug
As of #669 we have a conditional check (
{{if foo="bar}}
). #1128 introduced a!=
notation too.The portion of code that does the actual parsing looks like this:
The problem with this is that if the matched attribute value contains a "=" (which can happen if it's e.g. a URL with query params) the code above will evaluate to
true
, we will split the string (URL in our example) in half and try to do an equality check which, naturally, will fail.Short-term solution
Try to determine if a attribute is an URL. If so, don't do the conditional check, use only length check. **In practical terms, this would mean that if a string looks like an URL, it will be impossible to compare its value, e.g. no
{{if {url}=https://www.example.com}}}
. Ifurl
has a value, the check will evaluate totrue
, always.Proposed long-term solution
We should probably give up our custom markup and move to some well-used template engine, e.g. https://github.com/sstur/jinja-js.
The text was updated successfully, but these errors were encountered: