Skip to content

Commit

Permalink
replace invalid utf8 with \ufffd
Browse files Browse the repository at this point in the history
  • Loading branch information
ara4n committed Jul 2, 2018
1 parent 1c867f5 commit fc4f8f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions synapse/http/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _finished_processing(self):
# 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
Expand All @@ -120,7 +120,7 @@ def _finished_processing(self):
# 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}"
Expand Down

0 comments on commit fc4f8f3

Please sign in to comment.