summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristoph <47949835+Sir-Photch@users.noreply.github.com>2023-10-09 02:16:07 -0700
committerGitHub <noreply@github.com>2023-10-09 10:16:07 +0100
commit32fd9bc673ec025af5b49f4ed0961134a6101c38 (patch)
tree8a73bf251b855f211ae8a1fda0048e4f81675ed6
parentApply join rate limiter outside the lineariser (#16441) (diff)
downloadsynapse-32fd9bc673ec025af5b49f4ed0961134a6101c38.tar.xz
Fix possible AttributeError when account-api is called over unix socket (#16404)
Fixes #16396
-rw-r--r--changelog.d/16404.bugfix1
-rw-r--r--synapse/api/auth/internal.py2
2 files changed, 2 insertions, 1 deletions
diff --git a/changelog.d/16404.bugfix b/changelog.d/16404.bugfix
new file mode 100644
index 0000000000..3fd5028b33
--- /dev/null
+++ b/changelog.d/16404.bugfix
@@ -0,0 +1 @@
+Fixes possbile `AttributeError` when `_matrix/client/v3/account/whoami` is called over a unix socket. Contributed by @Sir-Photch.
diff --git a/synapse/api/auth/internal.py b/synapse/api/auth/internal.py
index a75f6f2cc4..36ee9c8b8f 100644
--- a/synapse/api/auth/internal.py
+++ b/synapse/api/auth/internal.py
@@ -115,7 +115,7 @@ class InternalAuth(BaseAuth):
         Once get_user_by_req has set up the opentracing span, this does the actual work.
         """
         try:
-            ip_addr = request.getClientAddress().host
+            ip_addr = request.get_client_ip_if_available()
             user_agent = get_request_user_agent(request)
 
             access_token = self.get_access_token_from_request(request)