mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Better robustness in face of missing raw_path
This commit is contained in:
parent
107d47567d
commit
16fdabda97
1 changed files with 4 additions and 1 deletions
|
|
@ -88,7 +88,10 @@ class AsgiRouter:
|
||||||
|
|
||||||
async def __call__(self, scope, receive, send):
|
async def __call__(self, scope, receive, send):
|
||||||
# Because we care about "foo/bar" v.s. "foo%2Fbar" we decode raw_path ourselves
|
# 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:
|
for regex, view in self.routes:
|
||||||
match = regex.match(path)
|
match = regex.match(path)
|
||||||
if match is not None:
|
if match is not None:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue