Skip to content

Commit

Permalink
asgi: check raw_path is not None (#719)
Browse files Browse the repository at this point in the history
The ASGI spec
(https://asgi.readthedocs.io/en/latest/specs/www.html#http) seems to
imply that `None` is a valid value, so we need to check the value
itself, not just whether the key is present.

In particular, the [mangum](https://github.com/erm/mangum) adapter
passes `None` for this key.
  • Loading branch information
cldellow authored May 4, 2020
1 parent c91fb9e commit dbd2d70
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion datasette/utils/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def host(self):

@property
def path(self):
if "raw_path" in self.scope:
if self.scope.get("raw_path") is not None:
return self.scope["raw_path"].decode("latin-1")
else:
path = self.scope["path"]
Expand Down

0 comments on commit dbd2d70

Please sign in to comment.