Mercurial > cpython-lru_cache-weakref
diff Lib/zipfile.py @ 53753:75743aaee504
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.
........
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Mon, 04 May 2009 21:21:36 +0000 |
| parents | cef0fcc91559 |
| children | 538f4e774c18 |
line wrap: on
line diff
--- a/Lib/zipfile.py Mon May 04 21:01:20 2009 +0000 +++ b/Lib/zipfile.py Mon May 04 21:21:36 2009 +0000 @@ -959,7 +959,9 @@ """ # 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
