mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
237f7eb87a
13
CHANGES.md
13
CHANGES.md
@ -1,8 +1,17 @@
|
|||||||
Synapse 1.46.0rc1 (2021-10-27)
|
Synapse 1.46.0 (2021-11-02)
|
||||||
==============================
|
===========================
|
||||||
|
|
||||||
The cause of the [performance regression affecting Synapse 1.44](https://github.com/matrix-org/synapse/issues/11049) has been identified and fixed. ([\#11177](https://github.com/matrix-org/synapse/issues/11177))
|
The cause of the [performance regression affecting Synapse 1.44](https://github.com/matrix-org/synapse/issues/11049) has been identified and fixed. ([\#11177](https://github.com/matrix-org/synapse/issues/11177))
|
||||||
|
|
||||||
|
Bugfixes
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Fix a bug introduced in v1.46.0rc1 where URL previews of some XML documents would fail. ([\#11196](https://github.com/matrix-org/synapse/issues/11196))
|
||||||
|
|
||||||
|
|
||||||
|
Synapse 1.46.0rc1 (2021-10-27)
|
||||||
|
==============================
|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
10
debian/changelog
vendored
10
debian/changelog
vendored
@ -4,6 +4,16 @@ matrix-synapse-py3 (1.47.0+nmu1) UNRELEASED; urgency=medium
|
|||||||
|
|
||||||
-- root <root@cae79a6e79d7> Fri, 22 Oct 2021 22:20:31 +0000
|
-- root <root@cae79a6e79d7> Fri, 22 Oct 2021 22:20:31 +0000
|
||||||
|
|
||||||
|
matrix-synapse-py3 (1.46.0) stable; urgency=medium
|
||||||
|
|
||||||
|
[ Richard van der Hoff ]
|
||||||
|
* Compress debs with xz, to fix incompatibility of impish debs with reprepro.
|
||||||
|
|
||||||
|
[ Synapse Packaging team ]
|
||||||
|
* New synapse release 1.46.0.
|
||||||
|
|
||||||
|
-- Synapse Packaging team <packages@matrix.org> Tue, 02 Nov 2021 13:22:53 +0000
|
||||||
|
|
||||||
matrix-synapse-py3 (1.46.0~rc1) stable; urgency=medium
|
matrix-synapse-py3 (1.46.0~rc1) stable; urgency=medium
|
||||||
|
|
||||||
* New synapse release 1.46.0~rc1.
|
* New synapse release 1.46.0~rc1.
|
||||||
|
6
debian/rules
vendored
6
debian/rules
vendored
@ -51,5 +51,11 @@ override_dh_shlibdeps:
|
|||||||
override_dh_virtualenv:
|
override_dh_virtualenv:
|
||||||
./debian/build_virtualenv
|
./debian/build_virtualenv
|
||||||
|
|
||||||
|
override_dh_builddeb:
|
||||||
|
# force the compression to xzip, to stop dpkg-deb on impish defaulting to zstd
|
||||||
|
# (which requires reprepro 5.3.0-1.3, which is currently only in 'experimental' in Debian:
|
||||||
|
# https://metadata.ftp-master.debian.org/changelogs/main/r/reprepro/reprepro_5.3.0-1.3_changelog)
|
||||||
|
dh_builddeb -- -Zxz
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@ --with python-virtualenv
|
dh $@ --with python-virtualenv
|
||||||
|
@ -47,7 +47,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
__version__ = "1.46.0rc1"
|
__version__ = "1.46.0"
|
||||||
|
|
||||||
if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)):
|
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
|
# We import here so that we don't have to install a bunch of deps when
|
||||||
|
@ -718,9 +718,12 @@ def decode_body(
|
|||||||
if not body:
|
if not body:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# The idea here is that multiple encodings are tried until one works.
|
||||||
|
# Unfortunately the result is never used and then LXML will decode the string
|
||||||
|
# again with the found encoding.
|
||||||
for encoding in get_html_media_encodings(body, content_type):
|
for encoding in get_html_media_encodings(body, content_type):
|
||||||
try:
|
try:
|
||||||
body_str = body.decode(encoding)
|
body.decode(encoding)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@ -732,11 +735,11 @@ def decode_body(
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
# Create an HTML parser.
|
# Create an HTML parser.
|
||||||
parser = etree.HTMLParser(recover=True, encoding="utf-8")
|
parser = etree.HTMLParser(recover=True, encoding=encoding)
|
||||||
|
|
||||||
# Attempt to parse the body. Returns None if the body was successfully
|
# Attempt to parse the body. Returns None if the body was successfully
|
||||||
# parsed, but no tree was found.
|
# parsed, but no tree was found.
|
||||||
return etree.fromstring(body_str, parser)
|
return etree.fromstring(body, parser)
|
||||||
|
|
||||||
|
|
||||||
def _calc_og(tree: "etree.Element", media_uri: str) -> Dict[str, Optional[str]]:
|
def _calc_og(tree: "etree.Element", media_uri: str) -> Dict[str, Optional[str]]:
|
||||||
|
@ -277,6 +277,21 @@ class CalcOgTestCase(unittest.TestCase):
|
|||||||
tree = decode_body(html, "http://example.com/test.html")
|
tree = decode_body(html, "http://example.com/test.html")
|
||||||
self.assertIsNone(tree)
|
self.assertIsNone(tree)
|
||||||
|
|
||||||
|
def test_xml(self):
|
||||||
|
"""Test decoding XML and ensure it works properly."""
|
||||||
|
# Note that the strip() call is important to ensure the xml tag starts
|
||||||
|
# at the initial byte.
|
||||||
|
html = b"""
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
|
<head><title>Foo</title></head><body>Some text.</body></html>
|
||||||
|
""".strip()
|
||||||
|
tree = decode_body(html, "http://example.com/test.html")
|
||||||
|
og = _calc_og(tree, "http://example.com/test.html")
|
||||||
|
self.assertEqual(og, {"og:title": "Foo", "og:description": "Some text."})
|
||||||
|
|
||||||
def test_invalid_encoding(self):
|
def test_invalid_encoding(self):
|
||||||
"""An invalid character encoding should be ignored and treated as UTF-8, if possible."""
|
"""An invalid character encoding should be ignored and treated as UTF-8, if possible."""
|
||||||
html = b"""
|
html = b"""
|
||||||
|
Loading…
Reference in New Issue
Block a user