mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 13:46:02 -04:00
Consistently use db_to_json
to convert from database values to JSON objects. (#7849)
This commit is contained in:
parent
b0f031f92a
commit
f460da6031
22 changed files with 80 additions and 82 deletions
|
@ -100,8 +100,8 @@ def db_to_json(db_content):
|
|||
if isinstance(db_content, memoryview):
|
||||
db_content = db_content.tobytes()
|
||||
|
||||
# Decode it to a Unicode string before feeding it to json.loads, so we
|
||||
# consistenty get a Unicode-containing object out.
|
||||
# Decode it to a Unicode string before feeding it to json.loads, since
|
||||
# Python 3.5 does not support deserializing bytes.
|
||||
if isinstance(db_content, (bytes, bytearray)):
|
||||
db_content = db_content.decode("utf8")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue