Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
Merge tag 'v1.55.2' into babolivier/dinsic_1.58
Browse files Browse the repository at this point in the history
Synapse 1.55.2 (2022-03-24)
===========================

This patch version reverts the earlier fixes from Synapse 1.55.1, which could cause problems in certain deployments, and instead adds a cap to the version of Jinja to be installed. Again, this is to fix an incompatibility with version 3.1.0 of the [Jinja](https://pypi.org/project/Jinja2/) library, and again, deployments of Synapse using the `matrixdotorg/synapse` Docker image or Debian packages from packages.matrix.org are not affected.

Internal Changes
----------------

- Pin Jinja to <3.1.0, as Synapse fails to start with Jinja 3.1.0. ([\#12297](matrix-org/synapse#12297))
- Revert changes from 1.55.1 as they caused problems with older versions of Jinja ([\#12296](matrix-org/synapse#12296))
  • Loading branch information
babolivier committed Apr 28, 2022
2 parents c9b2e47 + 9925f9b commit c6b44cf
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Synapse 1.55.2 (2022-03-24)
===========================

This patch version reverts the earlier fixes from Synapse 1.55.1, which could cause problems in certain deployments, and instead adds a cap to the version of Jinja to be installed. Again, this is to fix an incompatibility with version 3.1.0 of the [Jinja](https://pypi.org/project/Jinja2/) library, and again, deployments of Synapse using the `matrixdotorg/synapse` Docker image or Debian packages from packages.matrix.org are not affected.

Internal Changes
----------------

- Pin Jinja to <3.1.0, as Synapse fails to start with Jinja 3.1.0. ([\#12297](https://github.com/matrix-org/synapse/issues/12297))
- Revert changes from 1.55.1 as they caused problems with older versions of Jinja ([\#12296](https://github.com/matrix-org/synapse/issues/12296))


Synapse 1.55.1 (2022-03-24)
===========================

Expand Down
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
matrix-synapse-py3 (1.55.2) stable; urgency=medium

* New synapse release 1.55.2.

-- Synapse Packaging team <[email protected]> Thu, 24 Mar 2022 19:07:11 +0000

matrix-synapse-py3 (1.55.1) stable; urgency=medium

* New synapse release 1.55.1.
Expand Down
2 changes: 1 addition & 1 deletion synapse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
except ImportError:
pass

__version__ = "1.55.1"
__version__ = "1.55.2"

if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)):
# We import here so that we don't have to install a bunch of deps when
Expand Down
9 changes: 4 additions & 5 deletions synapse/push/mailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import bleach
import jinja2
from markupsafe import Markup

from synapse.api.constants import EventTypes, Membership, RoomTypes
from synapse.api.errors import StoreError
Expand Down Expand Up @@ -868,7 +867,7 @@ def _make_unsubscribe_link(
)


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.
Expand All @@ -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,
Expand All @@ -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.
Expand All @@ -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))
)

Expand Down
4 changes: 2 additions & 2 deletions synapse/python_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@
# Note: 21.1.0 broke `/sync`, see #9936
"attrs>=19.2.0,!=21.1.0",
"netaddr>=0.7.18",
"Jinja2>=2.9",
"MarkupSafe>=2.0",
# Jinja2 3.1.0 removes the deprecated jinja2.Markup class, which we rely on.
"Jinja2<3.1.0",
"bleach>=1.4.3",
# We use `ParamSpec`, which was added in `typing-extensions` 3.10.0.0.
"typing-extensions>=3.10.0",
Expand Down

0 comments on commit c6b44cf

Please sign in to comment.