Skip to content

Commit

Permalink
Fix Python 3.8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed May 26, 2023
1 parent 0da6f45 commit d92d61f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mautrix/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.19.15"
__version__ = "0.19.16"
__author__ = "Tulir Asokan <[email protected]>"
__all__ = [
"api",
Expand Down
4 changes: 3 additions & 1 deletion mautrix/appservice/as_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d92d61f

Please sign in to comment.