aiohttp-zip-response 2.0.0__tar.gz → 2.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {aiohttp_zip_response-2.0.0 → aiohttp_zip_response-2.0.2}/PKG-INFO +2 -1
- {aiohttp_zip_response-2.0.0 → aiohttp_zip_response-2.0.2}/README.md +1 -0
- {aiohttp_zip_response-2.0.0 → aiohttp_zip_response-2.0.2}/aiohttp_zip_response/zip_response.py +35 -7
- {aiohttp_zip_response-2.0.0 → aiohttp_zip_response-2.0.2}/pyproject.toml +3 -2
- {aiohttp_zip_response-2.0.0 → aiohttp_zip_response-2.0.2}/LICENSE +0 -0
- {aiohttp_zip_response-2.0.0 → aiohttp_zip_response-2.0.2}/aiohttp_zip_response/__init__.py +0 -0
- {aiohttp_zip_response-2.0.0 → aiohttp_zip_response-2.0.2}/aiohttp_zip_response/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: aiohttp-zip-response
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: A AIOHTTP response class streaming a directory as ZIP archive
|
|
5
5
|
Home-page: https://github.com/DoctorJohn/aiohttp-zip-response
|
|
6
6
|
License: MIT
|
|
@@ -71,4 +71,5 @@ web.run_app(app)
|
|
|
71
71
|
## Caveats
|
|
72
72
|
|
|
73
73
|
- The `Content-Length` header is not set because the size of the ZIP archive is not known in advance. This means clients such as browsers cannot display a download progress bar.
|
|
74
|
+
- This package currently doesn't support streaming of symbolic links to directories.
|
|
74
75
|
|
|
@@ -44,3 +44,4 @@ web.run_app(app)
|
|
|
44
44
|
## Caveats
|
|
45
45
|
|
|
46
46
|
- The `Content-Length` header is not set because the size of the ZIP archive is not known in advance. This means clients such as browsers cannot display a download progress bar.
|
|
47
|
+
- This package currently doesn't support streaming of symbolic links to directories.
|
{aiohttp_zip_response-2.0.0 → aiohttp_zip_response-2.0.2}/aiohttp_zip_response/zip_response.py
RENAMED
|
@@ -39,15 +39,43 @@ class ZipResponse(web.StreamResponse):
|
|
|
39
39
|
async def yield_member_files(self) -> AsyncGenerator[AsyncMemberFile, None]:
|
|
40
40
|
async for member_path in self.yield_member_paths():
|
|
41
41
|
lstat = member_path.lstat()
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
relative_member_path = member_path.relative_to(self._base_path)
|
|
43
|
+
|
|
44
|
+
if member_path.is_symlink():
|
|
45
|
+
if member_path.is_file():
|
|
46
|
+
yield (
|
|
47
|
+
str(relative_member_path),
|
|
48
|
+
datetime.fromtimestamp(lstat.st_mtime),
|
|
49
|
+
lstat.st_mode,
|
|
50
|
+
ZIP_32,
|
|
51
|
+
self.yield_member_chunks(member_path),
|
|
52
|
+
)
|
|
53
|
+
else:
|
|
54
|
+
continue
|
|
55
|
+
|
|
56
|
+
elif member_path.is_file():
|
|
57
|
+
yield (
|
|
58
|
+
str(relative_member_path),
|
|
59
|
+
datetime.fromtimestamp(lstat.st_mtime),
|
|
60
|
+
lstat.st_mode,
|
|
61
|
+
ZIP_32,
|
|
62
|
+
self.yield_member_chunks(member_path),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
elif member_path.is_dir():
|
|
66
|
+
yield (
|
|
67
|
+
f"{relative_member_path}/",
|
|
68
|
+
datetime.fromtimestamp(lstat.st_mtime),
|
|
69
|
+
lstat.st_mode,
|
|
70
|
+
ZIP_32,
|
|
71
|
+
self.yield_member_chunks(member_path),
|
|
72
|
+
)
|
|
49
73
|
|
|
50
74
|
async def yield_member_chunks(self, path: Path) -> AsyncGenerator[bytes, None]:
|
|
75
|
+
if path.is_symlink():
|
|
76
|
+
yield str(path.resolve().relative_to(self._base_path)).encode()
|
|
77
|
+
return
|
|
78
|
+
|
|
51
79
|
if path.is_dir():
|
|
52
80
|
return
|
|
53
81
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "aiohttp-zip-response"
|
|
3
|
-
version = "2.0.
|
|
3
|
+
version = "2.0.2"
|
|
4
4
|
description = "A AIOHTTP response class streaming a directory as ZIP archive"
|
|
5
5
|
authors = ["Jonathan Ehwald <github@ehwald.info>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -34,7 +34,8 @@ pytest = "^8.2.2"
|
|
|
34
34
|
pytest-cov = "^5.0.0"
|
|
35
35
|
pytest-asyncio = "^0.23.7"
|
|
36
36
|
pytest-aiohttp = "^1.0.5"
|
|
37
|
-
|
|
37
|
+
pytest-randomly = "^3.15.0"
|
|
38
|
+
ruff = "^0.5.1"
|
|
38
39
|
mypy = "^1.10.1"
|
|
39
40
|
|
|
40
41
|
[tool.ruff.lint]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|