mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 13:45:12 +02:00
Load json file as binary instead of decoding to string (#109351)
This commit is contained in:
@@ -74,7 +74,7 @@ def load_json(
|
|||||||
Defaults to returning empty dict if file is not found.
|
Defaults to returning empty dict if file is not found.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
with open(filename, encoding="utf-8") as fdesc:
|
with open(filename, mode="rb") as fdesc:
|
||||||
return orjson.loads(fdesc.read()) # type: ignore[no-any-return]
|
return orjson.loads(fdesc.read()) # type: ignore[no-any-return]
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
# This is not a fatal error
|
# This is not a fatal error
|
||||||
|
Reference in New Issue
Block a user