Fix Content-Length mismatch on range requests (206 Partial Content)

This commit is contained in:
2026-02-06 16:14:35 +08:00
parent 77a46d0725
commit 54705ab9c4
2 changed files with 3 additions and 2 deletions

View File

@@ -999,6 +999,7 @@ def _apply_object_headers(
etag: str, etag: str,
) -> None: ) -> None:
if file_stat is not None: if file_stat is not None:
if response.status_code != 206:
response.headers["Content-Length"] = str(file_stat.st_size) response.headers["Content-Length"] = str(file_stat.st_size)
response.headers["Last-Modified"] = http_date(file_stat.st_mtime) response.headers["Last-Modified"] = http_date(file_stat.st_mtime)
response.headers["ETag"] = f'"{etag}"' response.headers["ETag"] = f'"{etag}"'

View File

@@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
APP_VERSION = "0.2.6" APP_VERSION = "0.2.7"
def get_version() -> str: def get_version() -> str: