Index: Lib/zipfile.py =================================================================== --- Lib/zipfile.py (revision 74955) +++ Lib/zipfile.py (working copy) @@ -351,9 +351,14 @@ def _decodeFilename(self): if self.flag_bits & 0x800: - return self.filename.decode('utf-8') + fname = self.filename.decode('utf-8') else: - return self.filename + fname = self.filename + # Ensure forward slashes as stated in the standard, in case the + # compressor did this minor error. + if '\\' in fname: + fname = fname.replace('\\', '/') + return fname def _decodeExtra(self): # Try to decode the extra field. @@ -767,6 +772,10 @@ if self.debug > 2: print centdir filename = fp.read(centdir[_CD_FILENAME_LENGTH]) + # Ensure forward slashes as stated in the standard, in case the + # compressor did this minor error. + if '\\' in filename: + filename = filename.replace('\\', '/') # Create ZipInfo instance to store file information x = ZipInfo(filename) x.extra = fp.read(centdir[_CD_EXTRA_FIELD_LENGTH]) @@ -879,6 +888,10 @@ fname = zef_file.read(fheader[_FH_FILENAME_LENGTH]) if fheader[_FH_EXTRA_FIELD_LENGTH]: zef_file.read(fheader[_FH_EXTRA_FIELD_LENGTH]) + # Ensure forward slashes as stated in the standard, in case the + # compressor did this minor error. + if '\\' in fname: + fname = fname.replace('\\', '/') if fname != zinfo.orig_filename: raise BadZipfile, \