mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 09:56:05 -04:00
Use the JSON encoder without whitespace in more places. (#8124)
This commit is contained in:
parent
5eac0b7e76
commit
dbc630a628
9 changed files with 21 additions and 27 deletions
|
@ -15,13 +15,12 @@
|
|||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import attr
|
||||
from canonicaljson import json
|
||||
|
||||
from synapse.api.errors import StoreError
|
||||
from synapse.storage._base import SQLBaseStore, db_to_json
|
||||
from synapse.storage.database import LoggingTransaction
|
||||
from synapse.types import JsonDict
|
||||
from synapse.util import stringutils as stringutils
|
||||
from synapse.util import json_encoder, stringutils
|
||||
|
||||
|
||||
@attr.s
|
||||
|
@ -73,7 +72,7 @@ class UIAuthWorkerStore(SQLBaseStore):
|
|||
StoreError if a unique session ID cannot be generated.
|
||||
"""
|
||||
# The clientdict gets stored as JSON.
|
||||
clientdict_json = json.dumps(clientdict)
|
||||
clientdict_json = json_encoder.encode(clientdict)
|
||||
|
||||
# autogen a session ID and try to create it. We may clash, so just
|
||||
# try a few times till one goes through, giving up eventually.
|
||||
|
@ -144,7 +143,7 @@ class UIAuthWorkerStore(SQLBaseStore):
|
|||
await self.db_pool.simple_upsert(
|
||||
table="ui_auth_sessions_credentials",
|
||||
keyvalues={"session_id": session_id, "stage_type": stage_type},
|
||||
values={"result": json.dumps(result)},
|
||||
values={"result": json_encoder.encode(result)},
|
||||
desc="mark_ui_auth_stage_complete",
|
||||
)
|
||||
except self.db_pool.engine.module.IntegrityError:
|
||||
|
@ -185,7 +184,7 @@ class UIAuthWorkerStore(SQLBaseStore):
|
|||
The dictionary from the client root level, not the 'auth' key.
|
||||
"""
|
||||
# The clientdict gets stored as JSON.
|
||||
clientdict_json = json.dumps(clientdict)
|
||||
clientdict_json = json_encoder.encode(clientdict)
|
||||
|
||||
await self.db_pool.simple_update_one(
|
||||
table="ui_auth_sessions",
|
||||
|
@ -234,7 +233,7 @@ class UIAuthWorkerStore(SQLBaseStore):
|
|||
txn,
|
||||
table="ui_auth_sessions",
|
||||
keyvalues={"session_id": session_id},
|
||||
updatevalues={"serverdict": json.dumps(serverdict)},
|
||||
updatevalues={"serverdict": json_encoder.encode(serverdict)},
|
||||
)
|
||||
|
||||
async def get_ui_auth_session_data(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue