mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-04 02:54:49 -04:00
Revert "Replace instances of deprecated Jinja2.Markup
with markupsafe.Markup
" (#12296)
This reverts commit 8810c93e82
.
This commit is contained in:
parent
e689cae47d
commit
0004260952
2 changed files with 4 additions and 6 deletions
|
@ -18,7 +18,6 @@ from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, TypeVar
|
|||
|
||||
import bleach
|
||||
import jinja2
|
||||
from markupsafe import Markup
|
||||
|
||||
from synapse.api.constants import EventTypes, Membership, RoomTypes
|
||||
from synapse.api.errors import StoreError
|
||||
|
@ -868,7 +867,7 @@ class Mailer:
|
|||
)
|
||||
|
||||
|
||||
def safe_markup(raw_html: str) -> Markup:
|
||||
def safe_markup(raw_html: str) -> jinja2.Markup:
|
||||
"""
|
||||
Sanitise a raw HTML string to a set of allowed tags and attributes, and linkify any bare URLs.
|
||||
|
||||
|
@ -878,7 +877,7 @@ def safe_markup(raw_html: str) -> Markup:
|
|||
Returns:
|
||||
A Markup object ready to safely use in a Jinja template.
|
||||
"""
|
||||
return Markup(
|
||||
return jinja2.Markup(
|
||||
bleach.linkify(
|
||||
bleach.clean(
|
||||
raw_html,
|
||||
|
@ -892,7 +891,7 @@ def safe_markup(raw_html: str) -> Markup:
|
|||
)
|
||||
|
||||
|
||||
def safe_text(raw_text: str) -> Markup:
|
||||
def safe_text(raw_text: str) -> jinja2.Markup:
|
||||
"""
|
||||
Sanitise text (escape any HTML tags), and then linkify any bare URLs.
|
||||
|
||||
|
@ -902,7 +901,7 @@ def safe_text(raw_text: str) -> Markup:
|
|||
Returns:
|
||||
A Markup object ready to safely use in a Jinja template.
|
||||
"""
|
||||
return Markup(
|
||||
return jinja2.Markup(
|
||||
bleach.linkify(bleach.clean(raw_text, tags=[], attributes=[], strip=False))
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue