diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-04-13 09:28:17 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-04-13 09:28:17 (GMT) |
commit | 6fa83f99af03cc84caccc19988c1e346958789cb (patch) | |
tree | eac7f6ff8e977c5d31ec4c1241ea26141d68bada /Lib/zipfile.py | |
parent | b6cdae3db4ebcd34ba7039b2b1423f5ff4e235d6 (diff) | |
download | cpython-6fa83f99af03cc84caccc19988c1e346958789cb.zip cpython-6fa83f99af03cc84caccc19988c1e346958789cb.tar.gz cpython-6fa83f99af03cc84caccc19988c1e346958789cb.tar.bz2 |
Issue #17656: Fix extraction of zip files with unicode member paths.
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 9d1a984..6639317 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -1053,7 +1053,10 @@ class ZipFile(object): if os.path.sep == '\\': # filter illegal characters on Windows illegal = ':<>|"?*' - table = string.maketrans(illegal, '_' * len(illegal)) + if isinstance(arcname, unicode): + table = {ord(c): ord('_') for c in illegal} + else: + table = string.maketrans(illegal, '_' * len(illegal)) arcname = arcname.translate(table) # remove trailing dots arcname = (x.rstrip('.') for x in arcname.split(os.path.sep)) |