mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
Fix translating of illegal characters on Windows (issue #6972).
This commit is contained in:
parent
23298cb7f5
commit
7c068750b6
1 changed files with 2 additions and 1 deletions
|
@ -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):
|
||||||
# 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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue