forked from MirrorHub/synapse
Merge pull request #2483 from jeremycline/unfreeze-ujson-dump
Unfreeze event before serializing with ujson
This commit is contained in:
commit
bc7f3eb32f
1 changed files with 2 additions and 1 deletions
|
@ -25,6 +25,7 @@ from synapse.types import (
|
||||||
from synapse.util.async import run_on_reactor, ReadWriteLock, Limiter
|
from synapse.util.async import run_on_reactor, ReadWriteLock, Limiter
|
||||||
from synapse.util.logcontext import preserve_fn
|
from synapse.util.logcontext import preserve_fn
|
||||||
from synapse.util.metrics import measure_func
|
from synapse.util.metrics import measure_func
|
||||||
|
from synapse.util.frozenutils import unfreeze
|
||||||
from synapse.visibility import filter_events_for_client
|
from synapse.visibility import filter_events_for_client
|
||||||
|
|
||||||
from ._base import BaseHandler
|
from ._base import BaseHandler
|
||||||
|
@ -555,7 +556,7 @@ class MessageHandler(BaseHandler):
|
||||||
|
|
||||||
# Ensure that we can round trip before trying to persist in db
|
# Ensure that we can round trip before trying to persist in db
|
||||||
try:
|
try:
|
||||||
dump = ujson.dumps(event.content)
|
dump = ujson.dumps(unfreeze(event.content))
|
||||||
ujson.loads(dump)
|
ujson.loads(dump)
|
||||||
except:
|
except:
|
||||||
logger.exception("Failed to encode content: %r", event.content)
|
logger.exception("Failed to encode content: %r", event.content)
|
||||||
|
|
Loading…
Reference in a new issue