cpython: ebef003a2acd (original) (raw)

--- a/Lib/test/test_zipfile.py +++ b/Lib/test/test_zipfile.py @@ -434,8 +434,6 @@ class TestsWithSourceFile(unittest.TestC ('/foo/bar', 'foo/bar'), ('/foo/../bar', 'foo/bar'), ('/foo/../../bar', 'foo/bar'),

@@ -447,16 +445,22 @@ class TestsWithSourceFile(unittest.TestC (r'C:/foo/bar', 'foo/bar'), (r'C://foo/bar', 'foo/bar'), (r'C:\foo\bar', 'foo/bar'),

for arcname, fixedname in hacknames: @@ -469,7 +473,8 @@ class TestsWithSourceFile(unittest.TestC with zipfile.ZipFile(TESTFN2, 'r') as zipfp: writtenfile = zipfp.extract(arcname, targetpath)

@@ -482,7 +487,8 @@ class TestsWithSourceFile(unittest.TestC with zipfile.ZipFile(TESTFN2, 'r') as zipfp: writtenfile = zipfp.extract(arcname)

--- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -1050,11 +1050,14 @@ class ZipFile(object): arcname = os.path.splitdrive(arcname)[1] arcname = os.path.sep.join(x for x in arcname.split(os.path.sep) if x not in ('', os.path.curdir, os.path.pardir))

targetpath = os.path.join(targetpath, arcname) targetpath = os.path.normpath(targetpath)