Commit c82c4c34 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #22201: Command-line interface of the zipfile module now correctly

extracts ZIP files with directory entries.  Patch by Ryan Wilson.
parent f880bff4
......@@ -1492,18 +1492,7 @@ def main(args = None):
sys.exit(1)
with ZipFile(args[1], 'r') as zf:
out = args[2]
for path in zf.namelist():
if path.startswith('./'):
tgt = os.path.join(out, path[2:])
else:
tgt = os.path.join(out, path)
tgtdir = os.path.dirname(tgt)
if not os.path.exists(tgtdir):
os.makedirs(tgtdir)
with open(tgt, 'wb') as fp:
fp.write(zf.read(path))
zf.extractall(args[2])
elif args[0] == '-c':
if len(args) < 3:
......
......@@ -84,6 +84,12 @@ Extension Modules
adds support for the Linux AArch64 and POWERPC ELF ABIv2 little endian
architectures.
Tools/Demos
-----------
- Issue #22201: Command-line interface of the zipfile module now correctly
extracts ZIP files with directory entries. Patch by Ryan Wilson.
Tests
-----
......
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