Ignore room state with null bytes in for room stats
This commit is contained in:
parent
862b2f9ad5
commit
fa4b54aca5
|
@ -328,6 +328,21 @@ class StatsStore(StateDeltasStore):
|
||||||
room_id (str)
|
room_id (str)
|
||||||
fields (dict[str:Any])
|
fields (dict[str:Any])
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
# For whatever reason some of the fields may contain null bytes, which
|
||||||
|
# postgres isn't a fan of, so we replace those fields with null.
|
||||||
|
for col in (
|
||||||
|
"join_rules",
|
||||||
|
"history_visibility",
|
||||||
|
"encryption",
|
||||||
|
"name",
|
||||||
|
"topic",
|
||||||
|
"avatar",
|
||||||
|
"canonical_alias"
|
||||||
|
):
|
||||||
|
if "\0" in fields.get(col, ""):
|
||||||
|
fields[col] = None
|
||||||
|
|
||||||
return self._simple_upsert(
|
return self._simple_upsert(
|
||||||
table="room_state",
|
table="room_state",
|
||||||
keyvalues={"room_id": room_id},
|
keyvalues={"room_id": room_id},
|
||||||
|
|
Loading…
Reference in New Issue