summary refs log tree commit diff
path: root/synapse/rest/media/v1
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2021-07-21 09:47:56 -0400
committerGitHub <noreply@github.com>2021-07-21 09:47:56 -0400
commit5db118626bebb9ce3913758282787d47cd8f375e (patch)
tree9515e33f8e3a319f2e76ca88094654d946304979 /synapse/rest/media/v1
parentSwitch to `chunk` events so we can auth via power_levels (MSC2716) (#10432) (diff)
downloadsynapse-5db118626bebb9ce3913758282787d47cd8f375e.tar.xz
Add a return type to parse_string. (#10438)
And set the required attribute in a few places which will error if
a parameter is not provided.
Diffstat (limited to 'synapse/rest/media/v1')
-rw-r--r--synapse/rest/media/v1/preview_url_resource.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/synapse/rest/media/v1/preview_url_resource.py b/synapse/rest/media/v1/preview_url_resource.py
index 8e7fead3a2..172212ee3a 100644
--- a/synapse/rest/media/v1/preview_url_resource.py
+++ b/synapse/rest/media/v1/preview_url_resource.py
@@ -186,15 +186,11 @@ class PreviewUrlResource(DirectServeJsonResource):
         respond_with_json(request, 200, {}, send_cors=True)
 
     async def _async_render_GET(self, request: SynapseRequest) -> None:
-        # This will always be set by the time Twisted calls us.
-        assert request.args is not None
-
         # XXX: if get_user_by_req fails, what should we do in an async render?
         requester = await self.auth.get_user_by_req(request)
-        url = parse_string(request, "url")
-        if b"ts" in request.args:
-            ts = parse_integer(request, "ts")
-        else:
+        url = parse_string(request, "url", required=True)
+        ts = parse_integer(request, "ts")
+        if ts is None:
             ts = self.clock.time_msec()
 
         # XXX: we could move this into _do_preview if we wanted.