[FIX] sometimes responses dont contain a _path reference

This commit is contained in:
arabcoders 2025-11-10 16:47:35 +03:00
parent ddd7f77551
commit 3dd5357f24

View file

@ -262,8 +262,8 @@ class HttpAPI:
response: Response = await handler(request)
contentType: str | None = response.headers.get("content-type", None)
if contentType and contentType.startswith("text/html"):
contentType: str = response.headers.get("content-type", "")
if contentType.startswith("text/html") and getattr(response, "_path", None):
rewrite_path: str = base_path.rstrip("/")
async with await anyio.open_file(response._path, "rb") as f:
content = await f.read()