diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-05-04 21:24:37 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-05-04 21:24:37 (GMT) |
commit | e199a494677933cbfce3fa7a3ee4bd2f40113153 (patch) | |
tree | 5da3890b9a213cf15b3f86142810434b5186229b /Lib | |
parent | 6da51a120d5f395a0342ac4d533f5b5ce95093de (diff) | |
download | cpython-e199a494677933cbfce3fa7a3ee4bd2f40113153.zip cpython-e199a494677933cbfce3fa7a3ee4bd2f40113153.tar.gz cpython-e199a494677933cbfce3fa7a3ee4bd2f40113153.tar.bz2 |
Merged revisions 72295 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r72295 | antoine.pitrou | 2009-05-04 23:17:17 +0200 (lun., 04 mai 2009) | 3 lines
Issue #5692: In :class:`zipfile.Zipfile`, fix wrong path calculation when extracting a file to the root directory.
........
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/zipfile.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py index fe01296..aa88563 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -940,7 +940,9 @@ class ZipFile: """ # build the destination pathname, replacing # forward slashes to platform specific separators. - if targetpath[-1:] in (os.path.sep, os.path.altsep): + # Strip trailing path separator, unless it represents the root. + if (targetpath[-1:] in (os.path.sep, os.path.altsep) + and len(os.path.splitdrive(targetpath)[1]) > 1): targetpath = targetpath[:-1] # don't include leading "/" from file name if present |