diff options
author | Erik Johnston <erik@matrix.org> | 2019-08-01 13:23:00 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2019-08-01 13:23:00 +0100 |
commit | d2e3d5b9db346c88b31ff5eef2793c5cf82f698e (patch) | |
tree | 8fd9e5733a637143dd6637a4c6f5817c7061c75d | |
parent | Merge pull request #5802 from matrix-org/erikj/deny_redacting_different_room (diff) | |
download | synapse-d2e3d5b9db346c88b31ff5eef2793c5cf82f698e.tar.xz |
Handle incorrectly encoded query params correctly
-rw-r--r-- | synapse/http/servlet.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/http/servlet.py b/synapse/http/servlet.py index f0ca7d9aba..fd07bf7b8e 100644 --- a/synapse/http/servlet.py +++ b/synapse/http/servlet.py @@ -166,7 +166,12 @@ def parse_string_from_args( value = args[name][0] if encoding: - value = value.decode(encoding) + try: + value = value.decode(encoding) + except ValueError: + raise SynapseError( + 400, "Query parameter %r must be %s" % (name, encoding) + ) if allowed_values is not None and value not in allowed_values: message = "Query parameter %r must be one of [%s]" % ( |