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

Close providers.json stream when the json is loaded #12794

Merged
merged 3 commits into from
May 19, 2022
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
1 change: 1 addition & 0 deletions changelog.d/12794.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug introduced in 1.43.0 where a file (`providers.json`) was never closed. Contributed by @arkamar.
6 changes: 3 additions & 3 deletions synapse/config/oembed.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ def _parse_and_validate_providers(
"""
# Whether to use the packaged providers.json file.
if not oembed_config.get("disable_default_providers") or False:
providers = json.load(
pkg_resources.resource_stream("synapse", "res/providers.json")
)
with pkg_resources.resource_stream("synapse", "res/providers.json") as s:
providers = json.load(s)

yield from self._parse_and_validate_provider(
providers, config_path=("oembed",)
)
Expand Down