Skip to content

Commit d2464d1

Browse files
committed
more precise log for non-UTF-8 text-like
1 parent 49cac6d commit d2464d1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/zimscraperlib/zim/creator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ def _log_metadata(self):
183183
logger.debug(f"Metadata: {name} = {value.decode('UTF-8')}")
184184
except Exception:
185185
logger.debug(
186-
f"Metadata: {name} is a {len(value)} bytes {mimetype} blob"
186+
f"Metadata: {name} is a {len(value)} bytes {mimetype} blob "
187+
"not decodable as an UTF-8 string"
187188
)
188189
continue
189190

tests/zim/test_zim_creator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,10 @@ def __str__(self):
604604
mocked_logger.debug.assert_has_calls(
605605
[
606606
call("Metadata: Chars = šɔɛ"),
607-
call("Metadata: Chars-32 is a 16 bytes text/plain blob"),
607+
call(
608+
"Metadata: Chars-32 is a 16 bytes text/plain blob "
609+
"not decodable as an UTF-8 string"
610+
),
608611
call("Metadata: Creator = English speaking Wikipedia contributors"),
609612
call("Metadata: Date = 2009-11-21"),
610613
call(

0 commit comments

Comments
 (0)