Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add a return type to parse_string. #10438

Merged
merged 3 commits into from
Jul 21, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean-up some other parsing.
  • Loading branch information
clokep committed Jul 20, 2021
commit 0e944a2fc17cab56233257b2608518783e8f14fa
8 changes: 2 additions & 6 deletions synapse/rest/media/v1/preview_url_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,11 @@ async def _async_render_OPTIONS(self, request: Request) -> None:
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", required=True)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be an actual bugfix.

if b"ts" in request.args:
ts = parse_integer(request, "ts")
else:
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.
Expand Down