[issue6839] zipfile can't extract file

Berker Peksag report at bugs.python.org
Wed Apr 30 20:01:52 CEST 2014


Berker Peksag added the comment:

--- a/zipfile.py	Wed Apr 30 11:27:16 2014
+++ b/zipfile.py	Wed Apr 30 11:27:01 2014
@@ -1174,8 +1174,9 @@
             else:
                 fname_str = fname.decode("cp437")
 
-            if fname_str != zinfo.orig_filename:
-                raise BadZipFile(
+            if self.debug and fname_str != zinfo.orig_filename:
+                import warnings
+                warnings.warn(
                     'File name in directory %r and header %r differ.'
                     % (zinfo.orig_filename, fname))

Also, you need to add ``stacklevel=2`` to warnings.warn().

----------
nosy: +berker.peksag

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6839>
_______________________________________


More information about the Python-bugs-list mailing list