diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-02 17:51:37 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-02-02 17:51:37 (GMT) |
commit | 672671da47582101060819f94eb054fa344c6e5c (patch) | |
tree | 1f1b9eabb5a62d369d61af27956756e723439deb /Lib/zipfile.py | |
parent | d357a3f841ee41cee55575b5729658b5ecd45902 (diff) | |
parent | e5e64444979f0bb6c922f1c2742440f964ce6801 (diff) | |
download | cpython-672671da47582101060819f94eb054fa344c6e5c.zip cpython-672671da47582101060819f94eb054fa344c6e5c.tar.gz cpython-672671da47582101060819f94eb054fa344c6e5c.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 f5c3f17..8b355d6 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) |