diff --git a/__version__ b/__version__ index a9001b8f..069d8d5f 100644 --- a/__version__ +++ b/__version__ @@ -1 +1 @@ -__version__: v0.2.2-f9c7360 +__version__: v0.2.2-d539b1f diff --git a/zhenxun/utils/http_utils.py b/zhenxun/utils/http_utils.py index 1891e265..4637e108 100644 --- a/zhenxun/utils/http_utils.py +++ b/zhenxun/utils/http_utils.py @@ -286,7 +286,9 @@ class AsyncHttpx: f"Path: {path.absolute()}" ) async with aiofiles.open(path, "wb") as wf: - total = int(response.headers["Content-Length"]) + total = int( + response.headers.get("Content-Length", 0) + ) with rich.progress.Progress( # type: ignore rich.progress.TextColumn(path.name), # type: ignore "[progress.percentage]{task.percentage:>3.0f}%", # type: ignore @@ -295,7 +297,8 @@ class AsyncHttpx: rich.progress.TransferSpeedColumn(), # type: ignore ) as progress: download_task = progress.add_task( - "Download", total=total + "Download", + total=total if total else None, ) async for chunk in response.aiter_bytes(): await wf.write(chunk)