diff --git a/mautrix/__init__.py b/mautrix/__init__.py index ce7df73a..455409e9 100644 --- a/mautrix/__init__.py +++ b/mautrix/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.19.15" +__version__ = "0.19.16" __author__ = "Tulir Asokan " __all__ = [ "api", diff --git a/mautrix/appservice/as_handler.py b/mautrix/appservice/as_handler.py index b49a8583..9d5ad20a 100644 --- a/mautrix/appservice/as_handler.py +++ b/mautrix/appservice/as_handler.py @@ -83,7 +83,9 @@ def _check_token(self, request: web.Request) -> bool: token = request.rel_url.query["access_token"] except KeyError: try: - token = request.headers["Authorization"].removeprefix("Bearer ") + token = request.headers["Authorization"] + if token.startswith("Bearer "): + token = token[len("Bearer "):] except (KeyError, AttributeError): self.log.trace("No access_token nor Authorization header in request") return False