mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
asgi: check raw_path is not None (#719)
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.
This commit is contained in:
parent
c91fb9e3d4
commit
dbd2d70b38
1 changed files with 1 additions and 1 deletions
|
|
@ -46,7 +46,7 @@ class Request:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def path(self):
|
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")
|
return self.scope["raw_path"].decode("latin-1")
|
||||||
else:
|
else:
|
||||||
path = self.scope["path"]
|
path = self.scope["path"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue