Skip to content
Myr

autoescape selection uses case-insensitive comparison (#6013)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by GitHub · parents 06ea505, 9368fb3 · Browse files · 2 files+6 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+6 added−1 removed

  • other:+6 added−1 removed

2 files+6 added−1 removed

modified:src/flask/sansio/app.py+4 added-1 removed
532 unmodified lines
533 def select_jinja_autoescape(self, filename: str | None) -> bool:534 """Returns ``True`` if autoescaping should be active for the given535 template name. If no template name is given, returns `True`.536537 .. versionchanged:: 3.2538 Use case-insensitive comparison instead of only lower case.539540 .. versionchanged:: 2.2541 Autoescaping is now enabled by default for ``.svg`` files.542543 .. versionadded:: 0.5544 """545 if filename is None:546 return True544 return filename.endswith((".html", ".htm", ".xml", ".xhtml", ".svg"))547 return filename.lower().endswith((".html", ".htm", ".xml", ".xhtml", ".svg"))548549 @property550 def debug(self) -> bool:551 """Whether debug mode is enabled. When using ``flask run`` to start the
462 unmodified lines
modified:CHANGES.rst+2 added
24 unmodified lines
25 ``GET`` and ``POST`` redirects, and is also correct for frontend libraries26 such as HTMX. :issue:`5895`27- ``provide_automatic_options=True`` can be used to enable it for a view when28 it's disabled in config. Previously, only disabling worked. :issue:`5916`29- ``Flask.select_jinja_autoescape`` uses case-insensitive comparison instead30 of only lower case file extensions. :pr:`6012`313233Version 3.1.334-------------
1631 unmodified lines