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

Commit

Permalink
Properly close providers.json file stream. (#12794)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkamar authored May 19, 2022
1 parent 66a5f6c commit 684feea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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

0 comments on commit 684feea

Please sign in to comment.