diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2019-01-24 13:38:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-24 13:38:29 +0000 |
commit | f4697b5ec1071905b1177fd473e20df0b1455a4c (patch) | |
tree | afb42e9edaad1811f1649b06a6ae3208fb86c07d | |
parent | Merge pull request #4435 from matrix-org/neilj/fix_threepid_auth_check (diff) | |
download | synapse-f4697b5ec1071905b1177fd473e20df0b1455a4c.tar.xz |
Fix UnboundLocalError in post_urlencoded_get_json (#4460)
This could cause exceptions if the id server returned 4xx responses.
-rw-r--r-- | changelog.d/4460.bugfix | 1 | ||||
-rw-r--r-- | synapse/http/client.py | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/changelog.d/4460.bugfix b/changelog.d/4460.bugfix new file mode 100644 index 0000000000..8c5d5b4e0e --- /dev/null +++ b/changelog.d/4460.bugfix @@ -0,0 +1 @@ +Fix UnboundLocalError in post_urlencoded_get_json diff --git a/synapse/http/client.py b/synapse/http/client.py index afcf698b29..47a1f82ff0 100644 --- a/synapse/http/client.py +++ b/synapse/http/client.py @@ -333,9 +333,10 @@ class SimpleHttpClient(object): "POST", uri, headers=Headers(actual_headers), data=query_bytes ) + body = yield make_deferred_yieldable(readBody(response)) + if 200 <= response.code < 300: - body = yield make_deferred_yieldable(treq.json_content(response)) - defer.returnValue(body) + defer.returnValue(json.loads(body)) else: raise HttpResponseException(response.code, response.phrase, body) |