Commit 97377bf5 authored by Antoine Pitrou's avatar Antoine Pitrou

Issue #5692: In :class:`zipfile.Zipfile`, fix wrong path calculation when...

Issue #5692: In :class:`zipfile.Zipfile`, fix wrong path calculation when extracting a file to the root directory.
parent e3a3726b
...@@ -952,7 +952,9 @@ class ZipFile: ...@@ -952,7 +952,9 @@ class ZipFile:
""" """
# build the destination pathname, replacing # build the destination pathname, replacing
# forward slashes to platform specific separators. # 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] targetpath = targetpath[:-1]
# don't include leading "/" from file name if present # don't include leading "/" from file name if present
......
...@@ -269,6 +269,9 @@ Core and Builtins ...@@ -269,6 +269,9 @@ Core and Builtins
Library Library
------- -------
- Issue #5692: In :class:`zipfile.Zipfile`, fix wrong path calculation when
extracting a file to the root directory.
- Issue #5913: os.listdir() should fail for empty path on windows. - Issue #5913: os.listdir() should fail for empty path on windows.
- Issue #5084: unpickling now interns the attribute names of pickled objects, - Issue #5084: unpickling now interns the attribute names of pickled objects,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment