summaryrefslogtreecommitdiffstats
path: root/Lib/zipfile
diff options
context:
space:
mode:
authorAN Long <aisk@users.noreply.github.com>2024-01-07 01:14:18 (GMT)
committerGitHub <noreply@github.com>2024-01-07 01:14:18 (GMT)
commit541c5dbb81c784afd587406be2cc82645979a107 (patch)
tree447178bdd70fd7a8d866fe556e84eea4d8c6bee4 /Lib/zipfile
parent84d1f76092c24c4d6614797cc10eb8a231397646 (diff)
downloadcpython-541c5dbb81c784afd587406be2cc82645979a107.zip
cpython-541c5dbb81c784afd587406be2cc82645979a107.tar.gz
cpython-541c5dbb81c784afd587406be2cc82645979a107.tar.bz2
gh-112795: Allow `/` folder in a zipfile (#112932)
Allow extraction (no-op) of a "/" folder in a zipfile, they are commonly added by some archive creation tools. Co-authored-by: Erlend E. Aasland <erlend@python.org> Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Lib/zipfile')
-rw-r--r--Lib/zipfile/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/zipfile/__init__.py b/Lib/zipfile/__init__.py
index fe629ed..1c415a2 100644
--- a/Lib/zipfile/__init__.py
+++ b/Lib/zipfile/__init__.py
@@ -1772,7 +1772,7 @@ class ZipFile:
# filter illegal characters on Windows
arcname = self._sanitize_windows_name(arcname, os.path.sep)
- if not arcname:
+ if not arcname and not member.is_dir():
raise ValueError("Empty filename.")
targetpath = os.path.join(targetpath, arcname)