mirror of
https://github.com/python/cpython.git
synced 2025-08-29 05:05:03 +00:00
commit
672671da47
2 changed files with 21 additions and 6 deletions
|
@ -1238,11 +1238,14 @@ class ZipFile:
|
|||
arcname = os.path.splitdrive(arcname)[1]
|
||||
arcname = os.path.sep.join(x for x in arcname.split(os.path.sep)
|
||||
if x not in ('', os.path.curdir, os.path.pardir))
|
||||
# filter illegal characters on Windows
|
||||
if os.path.sep == '\\':
|
||||
# filter illegal characters on Windows
|
||||
illegal = ':<>|"?*'
|
||||
table = str.maketrans(illegal, '_' * len(illegal))
|
||||
arcname = arcname.translate(table)
|
||||
# remove trailing dots
|
||||
arcname = (x.rstrip('.') for x in arcname.split(os.path.sep))
|
||||
arcname = os.path.sep.join(x for x in arcname if x)
|
||||
|
||||
targetpath = os.path.join(targetpath, arcname)
|
||||
targetpath = os.path.normpath(targetpath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue