diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-02 17:52:45 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-02 17:52:45 (GMT) |
commit | fc23ec62a62193767b3c393d7c897e188213c6e0 (patch) | |
tree | 3f12cf8df9a0318546368efbf945cdef294f2444 /Lib/zipfile.py | |
parent | 8911ef5b6da16e4d4a640bcd70ee4c473aa1178f (diff) | |
parent | 672671da47582101060819f94eb054fa344c6e5c (diff) | |
download | cpython-fc23ec62a62193767b3c393d7c897e188213c6e0.zip cpython-fc23ec62a62193767b3c393d7c897e188213c6e0.tar.gz cpython-fc23ec62a62193767b3c393d7c897e188213c6e0.tar.bz2 |
Fix the test for issue #6972.
Remove trailing dots on Windows.
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r-- | Lib/zipfile.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py index 2ad4f88..ac09b0d 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -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) |