aboutsummaryrefslogtreecommitdiff
path: root/clientapi/routing/routing.go
diff options
context:
space:
mode:
authorPestdoktor <jonas@fentker.eu>2020-10-09 10:15:51 +0200
committerGitHub <noreply@github.com>2020-10-09 09:15:51 +0100
commitc4c8bfd0270f3d7009f0fb7c953a26e2cb65442d (patch)
tree133be1e4a7a76648c3a00bc9334de0ee23ec1b54 /clientapi/routing/routing.go
parentf3e8ae01efb0abd0904509ddaa2ae85017ca4aa5 (diff)
reject invalid UTF-8 (#1472)
* reject invalid UTF-8 Signed-off-by: Jonas Fentker <jonas@fentker.eu> * update sytest-whitelist Signed-off-by: Jonas Fentker <jonas@fentker.eu> Co-authored-by: Kegsay <kegan@matrix.org>
Diffstat (limited to 'clientapi/routing/routing.go')
-rw-r--r--clientapi/routing/routing.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/clientapi/routing/routing.go b/clientapi/routing/routing.go
index b547efb4..4f99237f 100644
--- a/clientapi/routing/routing.go
+++ b/clientapi/routing/routing.go
@@ -23,6 +23,7 @@ import (
appserviceAPI "github.com/matrix-org/dendrite/appservice/api"
"github.com/matrix-org/dendrite/clientapi/api"
"github.com/matrix-org/dendrite/clientapi/auth"
+ clientutil "github.com/matrix-org/dendrite/clientapi/httputil"
"github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/dendrite/clientapi/producers"
eduServerAPI "github.com/matrix-org/dendrite/eduserver/api"
@@ -659,8 +660,9 @@ func Setup(
SearchString string `json:"search_term"`
Limit int `json:"limit"`
}{}
- if err := json.NewDecoder(req.Body).Decode(&postContent); err != nil {
- return util.ErrorResponse(err)
+
+ if resErr := clientutil.UnmarshalJSONRequest(req, &postContent); resErr != nil {
+ return *resErr
}
return *SearchUserDirectory(
req.Context(),