Skip to content

Commit

Permalink
Better robustness in face of missing raw_path
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Jul 7, 2019
1 parent 65adf0e commit 726e824
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion datasette/utils/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ def __init__(self, routes=None):

async def __call__(self, scope, receive, send):
# Because we care about "foo/bar" v.s. "foo%2Fbar" we decode raw_path ourselves
path = scope["raw_path"].decode("ascii")
path = scope["path"]
raw_path = scope.get("raw_path")
if raw_path:
path = raw_path.decode("ascii")
for regex, view in self.routes:
match = regex.match(path)
if match is not None:
Expand Down

0 comments on commit 726e824

Please sign in to comment.