mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
Issue #6050: Don't fail extracting a directory from a zipfile if
the directory already exists.
This commit is contained in:
parent
53b578eba1
commit
0b09c42ffe
3 changed files with 10 additions and 1 deletions
|
@ -1023,6 +1023,11 @@ class TestWithDirectory(unittest.TestCase):
|
|||
self.assertTrue(os.path.isdir(os.path.join(TESTFN2, "a", "b")))
|
||||
self.assertTrue(os.path.exists(os.path.join(TESTFN2, "a", "b", "c")))
|
||||
|
||||
def test_bug_6050(self):
|
||||
# Extraction should succeed if directories already exist
|
||||
os.mkdir(os.path.join(TESTFN2, "a"))
|
||||
self.testExtractDir()
|
||||
|
||||
def testStoreDir(self):
|
||||
os.mkdir(os.path.join(TESTFN2, "x"))
|
||||
zipf = zipfile.ZipFile(TESTFN, "w")
|
||||
|
|
|
@ -971,6 +971,7 @@ class ZipFile:
|
|||
os.makedirs(upperdirs)
|
||||
|
||||
if member.filename[-1] == '/':
|
||||
if not os.path.isdir(targetpath):
|
||||
os.mkdir(targetpath)
|
||||
return targetpath
|
||||
|
||||
|
|
|
@ -302,6 +302,9 @@ Core and Builtins
|
|||
Library
|
||||
-------
|
||||
|
||||
- Issue #6050: Don't fail extracting a directory from a zipfile if
|
||||
the directory already exists.
|
||||
|
||||
- Issue #5311: bdist_msi can now build packages that do not depend on a
|
||||
specific Python version.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue