diff options
author | Charles Wright <cvwright@kombucha.systems> | 2021-09-17 12:04:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-17 18:04:37 +0100 |
commit | 6b6bb81b23425cf4f8e0c739946783b98ad056b8 (patch) | |
tree | f3765ea12a9b6195cf81e6b06f6115211bcd0d82 | |
parent | Merge branch 'release-v1.43' into develop (diff) | |
download | synapse-6b6bb81b23425cf4f8e0c739946783b98ad056b8.tar.xz |
Fix #10837 by adding JSON encoding/decoding to the Module API example… (#10845)
-rw-r--r-- | changelog.d/10845.doc | 1 | ||||
-rw-r--r-- | docs/modules/spam_checker_callbacks.md | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/changelog.d/10845.doc b/changelog.d/10845.doc new file mode 100644 index 0000000000..a13c845ae6 --- /dev/null +++ b/changelog.d/10845.doc @@ -0,0 +1 @@ +Fix some crashes in the Module API example code, by adding JSON encoding/decoding. diff --git a/docs/modules/spam_checker_callbacks.md b/docs/modules/spam_checker_callbacks.md index c45eafcc4b..81574a015c 100644 --- a/docs/modules/spam_checker_callbacks.md +++ b/docs/modules/spam_checker_callbacks.md @@ -136,9 +136,9 @@ class IsUserEvilResource(Resource): self.evil_users = config.get("evil_users") or [] def render_GET(self, request: Request): - user = request.args.get(b"user")[0] + user = request.args.get(b"user")[0].decode() request.setHeader(b"Content-Type", b"application/json") - return json.dumps({"evil": user in self.evil_users}) + return json.dumps({"evil": user in self.evil_users}).encode() class ListSpamChecker: |