mozilla / nunjucks

A powerful templating engine with inheritance, asynchronous control, and more (jinja2 inspired)
https://mozilla.github.io/nunjucks/
BSD 2-Clause "Simplified" License
8.48k stars 634 forks source link

fix: html encode backslashes if used with escape filter or autoescape #1437

Closed fdintino closed 1 year ago

fdintino commented 1 year ago

Backslashes should be html encoded when present in expressions that are passed to the escape filter (including when this happens automatically with autoescape)

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (fd50090) 89.65% compared to head (833797a) 89.65%.

:exclamation: Current head 833797a differs from pull request most recent head 5ea30b5. Consider uploading reports for the commit 5ea30b5 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1437 +/- ## ======================================= Coverage 89.65% 89.65% ======================================= Files 22 22 Lines 3046 3046 ======================================= Hits 2731 2731 Misses 315 315 ``` | [Impacted Files](https://codecov.io/gh/mozilla/nunjucks/pull/1437?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mozilla) | Coverage Δ | | |---|---|---| | [nunjucks/src/lib.js](https://codecov.io/gh/mozilla/nunjucks/pull/1437?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mozilla#diff-bnVuanVja3Mvc3JjL2xpYi5qcw==) | `86.54% <100.00%> (ø)` | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mozilla). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=mozilla)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.