diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-08-17 12:11:06 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-08-17 12:11:06 (GMT) |
commit | c82c4c34d8fceccc5942befa42440bbbe0359ac5 (patch) | |
tree | 2af4ddc112336d2e26b6f98eb9839f7289bccd23 /Lib/zipfile.py | |
parent | f880bff41ae75b1ae4e82183c39c8dc59c42bb49 (diff) | |
download | cpython-c82c4c34d8fceccc5942befa42440bbbe0359ac5.zip cpython-c82c4c34d8fceccc5942befa42440bbbe0359ac5.tar.gz cpython-c82c4c34d8fceccc5942befa42440bbbe0359ac5.tar.bz2 |
Issue #22201: Command-line interface of the zipfile module now correctly
extracts ZIP files with directory entries. Patch by Ryan Wilson.
Diffstat (limited to 'Lib/zipfile.py')
-rw-r--r-- | Lib/zipfile.py | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py index a0beae2..fe71765 100644 --- a/Lib/zipfile.py +++ b/Lib/zipfile.py @@ -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: |