diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2009-05-04 21:21:36 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2009-05-04 21:21:36 (GMT) |
commit | 3c33e087fc2178c76e76b29cb66d916742075fd4 (patch) | |
tree | 842a317fdadf719ec776e3591e11e6d7bd5e8b4a /Lib/zipfile.py | |
parent | 4f5f98d7d122d5d5fe17d97ac61b288abb45a5fc (diff) | |
download | cpython-3c33e087fc2178c76e76b29cb66d916742075fd4.zip cpython-3c33e087fc2178c76e76b29cb66d916742075fd4.tar.gz cpython-3c33e087fc2178c76e76b29cb66d916742075fd4.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/zipfile.py')
-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 a54a354..dab595b 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -959,7 +959,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 |