mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-12-15 21:33:48 -05:00
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.
This commit is contained in:
parent
2d89c66b88
commit
5db118626b
13 changed files with 86 additions and 45 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue