summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-08-17 12:17:56 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-08-17 12:17:56 (GMT)
commit95d5c9d5fff08e883613df42c99c6c8a9dab7733 (patch)
tree803adc63b24381b5d559c66aadf9eb4197361249 /Lib/zipfile.py
parentfbe912b7566f90835e968dbd01c2fa726ece6120 (diff)
parent97f17ff8405e1b6741ff1b1412befd0190896ae7 (diff)
downloadcpython-95d5c9d5fff08e883613df42c99c6c8a9dab7733.zip
cpython-95d5c9d5fff08e883613df42c99c6c8a9dab7733.tar.gz
cpython-95d5c9d5fff08e883613df42c99c6c8a9dab7733.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.py13
1 files changed, 1 insertions, 12 deletions
diff --git a/Lib/zipfile.py b/Lib/zipfile.py
index ee228b1..c577657 100644
--- a/Lib/zipfile.py
+++ b/Lib/zipfile.py
@@ -1764,18 +1764,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: