From 1208bcbfe84e852225c801a83cdb4c3b1d9956ca Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Sun, 23 Jun 2019 09:06:11 -0700 Subject: [PATCH] Handle tables%2fwith%2fslashes --- datasette/utils/asgi.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/datasette/utils/asgi.py b/datasette/utils/asgi.py index 8add01b1..c7afa21c 100644 --- a/datasette/utils/asgi.py +++ b/datasette/utils/asgi.py @@ -17,8 +17,10 @@ class AsgiRouter: ] 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") for regex, view in self.routes: - match = regex.match(scope["path"]) + match = regex.match(path) if match is not None: new_scope = dict(scope, url_route={"kwargs": match.groupdict()}) try: