mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-07-20 21:59:00 -04:00
Correct type hints for parse_string(s)_from_args. (#10137)
This commit is contained in:
parent
7dc14730d9
commit
9e4610cc27
8 changed files with 132 additions and 83 deletions
|
@ -17,6 +17,7 @@ import logging
|
|||
from hashlib import sha256
|
||||
from http import HTTPStatus
|
||||
from os import path
|
||||
from typing import Dict, List
|
||||
|
||||
import jinja2
|
||||
from jinja2 import TemplateNotFound
|
||||
|
@ -24,7 +25,7 @@ from jinja2 import TemplateNotFound
|
|||
from synapse.api.errors import NotFoundError, StoreError, SynapseError
|
||||
from synapse.config import ConfigError
|
||||
from synapse.http.server import DirectServeHtmlResource, respond_with_html
|
||||
from synapse.http.servlet import parse_string
|
||||
from synapse.http.servlet import parse_bytes_from_args, parse_string
|
||||
from synapse.types import UserID
|
||||
|
||||
# language to use for the templates. TODO: figure this out from Accept-Language
|
||||
|
@ -116,7 +117,8 @@ class ConsentResource(DirectServeHtmlResource):
|
|||
has_consented = False
|
||||
public_version = username == ""
|
||||
if not public_version:
|
||||
userhmac_bytes = parse_string(request, "h", required=True, encoding=None)
|
||||
args = request.args # type: Dict[bytes, List[bytes]]
|
||||
userhmac_bytes = parse_bytes_from_args(args, "h", required=True)
|
||||
|
||||
self._check_hash(username, userhmac_bytes)
|
||||
|
||||
|
@ -152,7 +154,8 @@ class ConsentResource(DirectServeHtmlResource):
|
|||
"""
|
||||
version = parse_string(request, "v", required=True)
|
||||
username = parse_string(request, "u", required=True)
|
||||
userhmac = parse_string(request, "h", required=True, encoding=None)
|
||||
args = request.args # type: Dict[bytes, List[bytes]]
|
||||
userhmac = parse_bytes_from_args(args, "h", required=True)
|
||||
|
||||
self._check_hash(username, userhmac)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue