mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Issue #5692: In :class:zipfile.Zipfile
, fix wrong path calculation when extracting a file to the root directory.
This commit is contained in:
parent
e3a3726b3d
commit
97377bf566
2 changed files with 6 additions and 1 deletions
|
@ -952,7 +952,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue