From 0f217b5e8d50070304b27a8788c01a5e75ddbdcd Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Wed, 25 Mar 2020 21:03:17 -0700 Subject: [PATCH] Apply path_from_header to entire scope, refs #712 --- datasette/app.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/datasette/app.py b/datasette/app.py index 33d41c41..c68e1cc5 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -742,13 +742,10 @@ class DatasetteRouter(AsgiRouter): async def __call__(self, scope, receive, send): path_from_header = self.ds.config("path_from_header") - path = scope["path"] - raw_path = scope.get("raw_path") if path_from_header: raw_path = dict(scope["headers"])[path_from_header.encode("utf8")] - if raw_path: - path = raw_path.decode("ascii") - return await self.route_path(scope, receive, send, path) + scope = dict(scope, raw_path=raw_path) + return await super().__call__(scope, receive, send) async def route_path(self, scope, receive, send, path): # Strip off base_url if present before routing