Skip to content

Commit 2d0cd09

Browse files
committed
Fixed URLProvider returning incomplete data
1 parent 0e2920a commit 2d0cd09

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project are documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (as of version 1.5.0).
77

8+
## [Unreleased]
9+
10+
### Changed
11+
12+
- Fixed `zim.providers.URLProvider` returning incomplete streams under certain circumstances (from https://github.com/openzim/kolibri/issues/40)
13+
814
## [2.0.0] - 2022-12-06
915

1016
- Using pylibzim v2.1.0 (using libzim 8.1.0)

src/zimscraperlib/zim/providers.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ def get_size(self) -> int:
9595
return self.size
9696

9797
def gen_blob(self) -> libzim.writer.Blob: # pragma: nocover
98-
bsize = 1048576 # 1MiB chunk
99-
for chunk in self.resp.iter_content(bsize):
100-
yield libzim.writer.Blob(chunk)
98+
for chunk in self.resp.iter_content(10 * 1024):
99+
if chunk:
100+
yield libzim.writer.Blob(chunk)
101+
yield libzim.writer.Blob(b"")

0 commit comments

Comments
 (0)