[game-data-packager] 01/01: zipfile comments: use 'replace' as hinted in similar #784330
Alexandre Detiste
detiste-guest at moszumanska.debian.org
Mon May 18 07:05:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
detiste-guest pushed a commit to branch master
in repository game-data-packager.
commit 0846d9947db12b5831ded32cf3f46dfba08b5a35
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date: Mon May 18 09:04:29 2015 +0200
zipfile comments: use 'replace' as hinted in similar #784330
catch more generic UnicodeError
---
game_data_packager/__init__.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 2774af0..f7c5ea2 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -1485,9 +1485,10 @@ class GameData(object):
if VERBOSE and fmt in ('zip', 'unzip'):
with zipfile.ZipFile(found_name, 'r') as zf:
if zf.comment:
+ encoding = provider.unpack.get('encoding', 'utf-8')
try:
- print(zf.comment.decode(provider.unpack.get('encoding', 'utf-8')))
- except (UnicodeDecodeError,UnicodeEncodeError):
+ print(zf.comment.decode(encoding, 'replace'))
+ except UnicodeError:
logger.warning("can't decode zip comment")
if fmt == 'dos2unix':
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git
More information about the Pkg-games-commits
mailing list