Skip to content

Handle invalid escaped quotes in tags more gracefully#1098

Merged
jasmith-hs merged 1 commit intomasterfrom
handle-invalid-escaped-quotes
Jul 27, 2023
Merged

Handle invalid escaped quotes in tags more gracefully#1098
jasmith-hs merged 1 commit intomasterfrom
handle-invalid-escaped-quotes

Conversation

@jasmith-hs
Copy link
Copy Markdown
Contributor

Don't break the entire parsing of the template afterwards by treating escaped quotes which aren't already in quotes as not being quotes.
This means that a token like the following would break the rest of the template:
{% print \"foo\" %}. This is because the initial slash currently does not get treated as escaping the double quote so the token scanner will think that it is inside of quotes.
In this example:

{% print \"foo\" %} I am "hungry" {% print 'x' %} " {% print 'y' %} " {% print 'z' %}

The scanner currently will parse tokens like the following:

  • {% print \"foo\" %} I am "hungry" {% print 'x' %} " {% print 'y' %} <- this token is broken and won't render properly
  • "
  • {% print 'z' %}

But with this change it will parse like:

  • {% print \"foo\" %} <- this token is broken and won't render properly
  • I am "hungry"
  • {% print 'x' %}
  • "
  • {% print 'y' %}
  • "
  • {% print 'z' %}

Essentially it limits the scope of the broken token down to just affecting the token which is broken.

Don't break the entire parsing of the template afterwards by treating escaped quotes which aren't already in quotes as not being quotes
@jasmith-hs jasmith-hs merged commit dbe407b into master Jul 27, 2023
@jasmith-hs jasmith-hs deleted the handle-invalid-escaped-quotes branch July 27, 2023 19:22
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

Successfully merging this pull request may close these issues.

1 participant