Skip to content

Commit

Permalink
fix RuntimeError related to static headers
Browse files Browse the repository at this point in the history
  • Loading branch information
redraw committed Mar 16, 2024
1 parent 9d7152d commit 0fd5f16
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion datasette/utils/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,14 @@ async def asgi_send_file(

def asgi_static(root_path, chunk_size=4096, headers=None, content_type=None):
root_path = Path(root_path)
headers = headers or {}
static_headers = {}

if headers:
static_headers = headers.copy()

async def inner_static(request, send):
path = request.scope["url_route"]["kwargs"]["path"]
headers = static_headers.copy()
try:
full_path = (root_path / path).resolve().absolute()
except FileNotFoundError:
Expand Down

0 comments on commit 0fd5f16

Please sign in to comment.