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

Handle invalid escaped quotes in tags more gracefully #1098

Merged
merged 1 commit into from
Jul 27, 2023

Conversation

jasmith-hs
Copy link
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