Commit 7c068750 authored by Serhiy Storchaka's avatar Serhiy Storchaka

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

parent 23298cb7
...@@ -5,6 +5,7 @@ import struct, os, time, sys, shutil ...@@ -5,6 +5,7 @@ import struct, os, time, sys, shutil
import binascii, cStringIO, stat import binascii, cStringIO, stat
import io import io
import re import re
import string
try: try:
import zlib # We may need its compression method import zlib # We may need its compression method
...@@ -1052,7 +1053,7 @@ class ZipFile(object): ...@@ -1052,7 +1053,7 @@ class ZipFile(object):
# filter illegal characters on Windows # filter illegal characters on Windows
if os.path.sep == '\\': if os.path.sep == '\\':
illegal = ':<>|"?*' illegal = ':<>|"?*'
table = str.maketrans(illegal, '_' * len(illegal)) table = string.maketrans(illegal, '_' * len(illegal))
arcname = arcname.translate(table) arcname = arcname.translate(table)
targetpath = os.path.join(targetpath, arcname) targetpath = os.path.join(targetpath, arcname)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment