case-insensitive comparison

This commit is contained in:
David Lord 2026-05-01 20:53:36 -07:00
parent 06ea505ce2
commit 9368fb3f3c
No known key found for this signature in database
GPG key ID: 43368A7AA8CC5926
2 changed files with 6 additions and 1 deletions

View file

@ -26,6 +26,8 @@ Unreleased
such as HTMX. :issue:`5895` such as HTMX. :issue:`5895`
- ``provide_automatic_options=True`` can be used to enable it for a view when - ``provide_automatic_options=True`` can be used to enable it for a view when
it's disabled in config. Previously, only disabling worked. :issue:`5916` it's disabled in config. Previously, only disabling worked. :issue:`5916`
- ``Flask.select_jinja_autoescape`` uses case-insensitive comparison instead
of only lower case file extensions. :pr:`6012`
Version 3.1.3 Version 3.1.3

View file

@ -534,6 +534,9 @@ class App(Scaffold):
"""Returns ``True`` if autoescaping should be active for the given """Returns ``True`` if autoescaping should be active for the given
template name. If no template name is given, returns `True`. template name. If no template name is given, returns `True`.
.. versionchanged:: 3.2
Use case-insensitive comparison instead of only lower case.
.. versionchanged:: 2.2 .. versionchanged:: 2.2
Autoescaping is now enabled by default for ``.svg`` files. Autoescaping is now enabled by default for ``.svg`` files.
@ -541,7 +544,7 @@ class App(Scaffold):
""" """
if filename is None: if filename is None:
return True return True
return filename.endswith((".html", ".htm", ".xml", ".xhtml", ".svg")) return filename.lower().endswith((".html", ".htm", ".xml", ".xhtml", ".svg"))
@property @property
def debug(self) -> bool: def debug(self) -> bool: