Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump lxml-stubs from 0.4.0 to 0.5.1 #16885

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions synapse/media/oembed.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,11 @@ def calc_description_and_urls(open_graph_response: JsonDict, html_body: str) ->
parser = etree.HTMLParser(recover=True, encoding="utf-8")

# Attempt to parse the body. If this fails, log and return no metadata.
# TODO Develop of lxml-stubs has this correct.
tree = etree.fromstring(html_body, parser) # type: ignore[arg-type]
tree = etree.fromstring(html_body, parser)

# The data was successfully parsed, but no tree was found.
if tree is None:
return # type: ignore[unreachable]
return

# Attempt to find interesting URLs (images, videos, embeds).
if "og:image" not in open_graph_response:
Expand Down
3 changes: 1 addition & 2 deletions synapse/media/preview_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ def decode_body(

# Attempt to parse the body. Returns None if the body was successfully
# parsed, but no tree was found.
# TODO Develop of lxml-stubs has this correct.
return etree.fromstring(body, parser) # type: ignore[arg-type]
return etree.fromstring(body, parser)


def _get_meta_tags(
Expand Down
Loading