diff options
author | Matthew Hodgson <matthew@matrix.org> | 2018-07-02 11:33:02 +0100 |
---|---|---|
committer | Matthew Hodgson <matthew@matrix.org> | 2018-07-02 11:33:02 +0100 |
commit | fc4f8f33be7bcfa8fca5d1aa1f07a1507e8d56e7 (patch) | |
tree | c46be248ddeb4bfb25f15036b4dab06ac80b96c3 | |
parent | a fix which doesn't NPE everywhere (diff) | |
download | synapse-fc4f8f33be7bcfa8fca5d1aa1f07a1507e8d56e7.tar.xz |
replace invalid utf8 with \ufffd
-rw-r--r-- | synapse/http/site.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/synapse/http/site.py b/synapse/http/site.py index 14ea9c21c8..fe93643b1e 100644 --- a/synapse/http/site.py +++ b/synapse/http/site.py @@ -111,7 +111,7 @@ class SynapseRequest(Request): # from a IDN servname in an auth header authenticated_entity = self.authenticated_entity if authenticated_entity is not None: - authenticated_entity = authenticated_entity.decode("utf-8") + authenticated_entity = authenticated_entity.decode("utf-8", "replace") # ...or could be raw utf-8 bytes in the User-Agent header. # N.B. if you don't do this, the logger explodes cryptically @@ -120,7 +120,7 @@ class SynapseRequest(Request): # c.f. https://github.com/matrix-org/synapse/issues/3471 user_agent = self.get_user_agent() if user_agent is not None: - user_agent = user_agent.decode("utf-8") + user_agent = user_agent.decode("utf-8", "replace") self.site.access_logger.info( "%s - %s - {%s}" |