summary refs log tree commit diff
path: root/synapse/rest/media/v1/preview_html.py
diff options
context:
space:
mode:
authorPatrick Cloke <patrickc@matrix.org>2021-12-09 15:37:00 -0500
committerPatrick Cloke <patrickc@matrix.org>2022-05-24 13:19:17 -0400
commit11a9925252bfe6c08718740499094d571e4c81a7 (patch)
tree2e179837531cc989537bb70130a6409086bd6f9f /synapse/rest/media/v1/preview_html.py
parentRemove dead code. (diff)
downloadsynapse-11a9925252bfe6c08718740499094d571e4c81a7.tar.xz
Re-use decode_body.
Diffstat (limited to '')
-rw-r--r--synapse/rest/media/v1/preview_html.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/rest/media/v1/preview_html.py b/synapse/rest/media/v1/preview_html.py
index c9711956f1..4dc9be5124 100644
--- a/synapse/rest/media/v1/preview_html.py
+++ b/synapse/rest/media/v1/preview_html.py
@@ -14,7 +14,7 @@
 import itertools
 import logging
 import re
-from typing import TYPE_CHECKING, Dict, Generator, Iterable, Iterator, Optional
+from typing import TYPE_CHECKING, Dict, Generator, Iterable, Iterator, Optional, Union
 
 if TYPE_CHECKING:
     from bs4 import BeautifulSoup
@@ -25,7 +25,7 @@ logger = logging.getLogger(__name__)
 _content_type_match = re.compile(r'.*; *charset="?(.*?)"?(;|$)', flags=re.I)
 
 
-def decode_body(body: bytes, uri: str) -> Optional["BeautifulSoup"]:
+def decode_body(body: Union[bytes, str], uri: str) -> Optional["BeautifulSoup"]:
     """
     This uses BeautifulSoup to parse the HTML document.