fix RuntimeError related to static headers

pull/2306/head
redraw 2024-03-16 14:37:41 -03:00
rodzic 9d7152da85
commit eacf20cbff
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -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: