]> granicus.if.org Git - python/commitdiff
Fix translating of illegal characters on Windows (issue #6972).
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 2 Feb 2013 10:30:49 +0000 (12:30 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Sat, 2 Feb 2013 10:30:49 +0000 (12:30 +0200)
Lib/zipfile.py

index 31000accbb55992faa2c965cf95c3fc04b78f03d..9af2986bf9a4e8076604ecb79effd89b748ae4d6 100644 (file)
@@ -5,6 +5,7 @@ import struct, os, time, sys, shutil
 import binascii, cStringIO, stat
 import io
 import re
+import string
 
 try:
     import zlib # We may need its compression method
@@ -1052,7 +1053,7 @@ class ZipFile(object):
         # filter illegal characters on Windows
         if os.path.sep == '\\':
             illegal = ':<>|"?*'
-            table = str.maketrans(illegal, '_' * len(illegal))
+            table = string.maketrans(illegal, '_' * len(illegal))
             arcname = arcname.translate(table)
 
         targetpath = os.path.join(targetpath, arcname)