Skip to content

Commit

Permalink
Apply path_from_header to entire scope, refs #712
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Mar 26, 2020
1 parent fb0460d commit 0f217b5
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions datasette/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,13 +742,10 @@ def __init__(self, datasette, routes):

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
Expand Down

0 comments on commit 0f217b5

Please sign in to comment.