Fix translating of illegal characters on Windows (issue #6972).

This commit is contained in:
Serhiy Storchaka 2013-02-02 12:30:49 +02:00
parent 23298cb7f5
commit 7c068750b6
1 changed files with 2 additions and 1 deletions

View 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)