From dbd2d70b3819a7041bb36a527033d77c85683c05 Mon Sep 17 00:00:00 2001 From: Colin Dellow Date: Mon, 4 May 2020 13:14:25 -0400 Subject: [PATCH] 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. --- datasette/utils/asgi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datasette/utils/asgi.py b/datasette/utils/asgi.py index df358240..73ae562b 100644 --- a/datasette/utils/asgi.py +++ b/datasette/utils/asgi.py @@ -46,7 +46,7 @@ class Request: @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"]